getsky/phalcon-bootstrap

Bootstrap Component for Phalcon

v1.4.2 2014-11-21 17:50 UTC

This package is not auto-updated.

Last update: 2024-03-25 23:30:17 UTC


README

This component is used as a basis for Pherlin. I recommend to use it instead of this bootstrap.

Run application

To launch the application, you need to execute code:

$app = new Bootstrap(new FactoryDefault());
echo $app->run();

Pass true into a method app(), if you do not want to run the handler:

$app = new Bootstrap(new FactoryDefault());
echo $app->run(true);

Configuration file

By default, the configuration file is here ../app/config/config_%environment%.yml. %environment% - environment under which the application is running.

To change the configuration file, you must use the method setPathConfig():

$app = new Bootstrap(new FactoryDefault());
$app->setPathConfig('config/config.%environment%.ini');
echo $app->run();

Environment

By default, the environment is set to `` `dev ```. To change it, pass the second parameter name of the desired environment.

$app = new Bootstrap(new FactoryDefault(), 'prod');

Сaching

Bootstrap allows you to cache the application configuration. When creating object of class Bootstrap, there is check the presence of apc or apcu. If APC(u) is found, the configuration will be cached. To disable caching, you should report it:

$app = new Bootstrap(new FactoryDefault(), 'prod');
$app->setCacheable(false);

// check
echo $app->isCacheable();
// print: false

If you are on the same machine run two copies of the site, you need to specify a different name for the application cache:

$app = new Bootstrap(new FactorDefault(), 'prod', 'FestApp');
// in another application:
$app = new Bootstrap(new FactorDefault(), 'prod', 'SecondApp');

Loader

If you need the autoloader (Phalcon\Loader), you can request it from the bootstrap:

$app = new Bootstrap(new FactoryDefault(), 'prod');

/**
* @var $loader Phalcon\Loader
*/
$loader = $app->getLoader();