Created: 2011-07-12 22:48
Updated: 2013-12-07 20:47
License: bsd-3-clause


Foundry Core


The Foundry Core libraries are an on-demand framework that provides infrastructure for module loading and dependency management. With the core framework modules you only need to know the name of the module to load and it's configuration parameters.

For example, you can configure and load a Mongo database connection with the following snippets:


// Provide configuration for the database
        'service' => 'Mongo',
        'service_options' => array(
            'host'      => 'localhost',
            'db'        => 'data'



// Require the database library
// This loads and caches a database object for later use in the framework.
$database = Core::requires('\foundry\core\database\Database');

// snip...

// You can also get the same loaded module later on with
$database = Core::get('\foundry\core\database\Database');

Note the configuration is seperate from usage and doesn't require the module to be loaded. This means you can configure all your modules in a single file and include it everywhere in your site but only load the modules when they're needed. Also, once a module is loaded it's cached in the framework so it only needs to be loaded once per instantiation.

Modules can also require other modules, so if you build a project management module that requires a database and authentication, you can put the necessary Core::requires('...') statements at the top of your module and when you use the module elsewhere you only need to use a single requires statement.


Include 'INSTALL_PATH/lib/_foundry_core_init.php' and consult the documentation for detailed use of the provided modules and module framework.


The foundry core framework is licensed under the new BSD License. See the LICENSE file for details.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more