djikstra
be humble.
Back Home Next
Framework In A Nutshell
Humble is a modular framework where custom modules are contained in packages. These packages are nothing more than directories/folders off of the application root and each application has one-to-many packages containing one-to-many modules. Each Module contains components, and these components are broken down into Controllers (XML Files), Models (Business Logic), Entities (Represent Tables/Collections), Helpers (Utility Classes), Views (Output Renderers), and Web Elements (JavaScript files, CSS, images, etc).

Each Module has its own configuration file, and each Module lays claim to its own unique namespace. All elements within the Module are referenced using this namespace and appropriate Factory method or URI.

Framework File Structure
/ App base directory, APIs, unreachable by anything not covered by the .htaccess file
/app/ Application root directory, core application factories and key files are located here
/app/Code/Framework/ The core framework files and classes. Don't hack on core if that's not your job
/app/Code/packages Your custom package (directory) that contains your custom modules
/app/Code/package/modules Your custom modules that make up your application


Framework Components
In the /app/ directory are some key files to the framework, and most are what we call "Static Factories". Other than the Environment and Log factory, you will not in normal application development ever need to call these, as most of the files here are for internal use. There is a centralized file for declaring constants (Enums), so feel free to add your custom constants to the Constants.php file found here.

/app/Humble.php The main framework factory. Gets extended in the installation step to create a branded factory
/app/Module.php Command Line Interface for the framework, see Command Line Interactions.
/app/Environment.php Factory, returns information about the current run environment
/app/Log.php Application logger, can write logs to many places
/app/Event.php Internal Factory, manages Event instantiation and propagation
/app/Trigger.php Internal Factory, used to trigger events
/app/Constants.php Can define your constants (ENUM) here
/app/Scheduler.php Internal, used to prep jobs to run at certain times of day
/app/Launcher.php Internal, executes jobs that have been prepped by the Scheduler
/app/Singleton.php Internal Factory, used to manage static variables that shouldn't be instantiated more than once
/app/allowed.json Authorized list of routes that are reachable without authentication, see Routing, Allowed Overrides.


Module File Structure
Each module is composed of directories where each directory represents some degree of functionality. Since Humble is a solidly MVC (Model-View-Controller) framework, we have directories with those very names. We also have 'Entities', which are DAO (Database Access Objects) containing custom queries and functionality outside of the basic CRUD (Create-Read-Update-Delete) functionality that is implicit, and 'Helpers' which are utility classes. The 'Images' directory holds images that are specific to the module, and the 'Schema' directory is broken down into two sub-directories: 'Install' and 'Update'. Any SQL placed in the 'Install' folder will be run during the initial install, and any SQL placed in the 'Update' folder will be run on the next update if the timestamp for the file is greater than the last update run. Finally we have the 'etc' folder which contains the application configuration file, 'RPC' (Remote Procedure Calls) which defines our "Smart Endpoints", and the 'web' folder that contains web components like JavaScript and CSS.

/Controllers XML Controllers, see Anatomy of a Controller
/Entities Database Access Objects named the same as the table to access
/Helpers Assorted helper classes
/Images Module Images (see Loading Resources)
/Models Business logic and workflow "Lego" components
/RPC/mapping.yaml Defines "Smart Endpoints" for integration (see Integration)
/Schema SQL used during module installs and updates
/Views/renderer Server side rendering views in a variety of templating languages
/etc/config.xml Module configuration file (see Configuration)
/web/app Client-side JS templates (see Decoupled UI)
/web/css Static CSS files (see Loading Resources)
/web/edits Form validation, possibly deprecated feature
/web/js Static JavaScript files (see Loading Resources)