Bluz\Application\Application::init PHP Method

init() public method

Initialize process
public init ( string $environment = 'production' ) : void
$environment string
return void
    public function init($environment = 'production')
    {
        $this->environment = $environment;
        try {
            // first log message
            Logger::info('app:init');
            // initial default helper path
            $this->addHelperPath(dirname(__FILE__) . '/Helper/');
            // init Config
            $this->initConfig();
            // init Session, start inside class (if needed)
            Session::getInstance();
            // init Messages
            Messages::getInstance();
            // init Translator
            Translator::getInstance();
            // init Request
            $this->initRequest();
            // init Response
            $this->initResponse();
            // init Router
            $this->initRouter();
        } catch (\Exception $e) {
            throw new ApplicationException("Application can't be loaded: " . $e->getMessage());
        }
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 public function init($environment = 'production')
 {
     parent::init($environment);
     $options = ['appId' => '...', 'restApiKey' => '...', 'masterKey' => '...'];
     ParseClient::initialize($options['appId'], $options['restApiKey'], $options['masterKey']);
 }