Created
June 20, 2011 11:42
-
-
Save trq/1035479 to your computer and use it in GitHub Desktop.
Proem Bootstrap Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This is just a running example of what a bootstrap file | |
* might look like to get an application built on top of | |
* Proem up and running. | |
* | |
* It's a good demo that gives me a design to work toward. | |
*/ | |
/** | |
* Register the autoloader | |
* Assumes the Proem/lib directory is already on php's include_path | |
*/ | |
Proem\Loader::getInstance()->registerAutoload(); | |
/** | |
* Instantiate the Application object | |
*/ | |
$application = new Proem\Application; | |
/** | |
* Setup the Chain. | |
*/ | |
$application->getChain()->registerEvents( | |
array( | |
'io' => new Proem\Chain\Event\IO, | |
'route' => new Proem\Chain\Event\Route, | |
'dispatch' => new Proem\Chain\Event\Dispatch | |
) | |
); | |
/** | |
* Boostrap the application by executing the chains events. | |
* The run() method here simply proxies through to the Chain's | |
* run() method, the main reason we use the Application objects | |
* version (and avoid method chaining is that it passes the | |
* Application object along with it internally, otherwise | |
* our call would look something like: | |
* | |
* $application->getChain()->registerEvents()->run($application); | |
* | |
* Not real pretty. | |
*/ | |
$application->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment