function show($resultArray = array(), $hasExit = "") { echo '<pre>'; print_r($resultArray); echo '</pre>'; if ($hasExit === 'exit') { exit; } } global $event; //create Event handler to attach all events $event = new Event(); $event->attach("exception", '\\Cygnite\\Exception\\Handler@handleException'); $config = array(); //Get the configuration variables. $config = array('app' => Config::load(), 'event' => $event); //unset($config); //Load application and Get application instance to boot up $application = Application::instance(function ($app) use($config) { /** *--------------------------------------------------- * Set Configurations and Events for boot-up process * -------------------------------------------------- */ return $app->setConfiguration($config)->boot(); }); //Response to browser $application->run(); if (Config::get('global.config', 'enable_profiling') == true) { Profiler::end(); }
| Create The Application |-------------------------------------------------------------------------- | | To boot framework first thing we will create a new application instance | which serves glue for all the components, and binding components | with the IoC container */ $app = \Cygnite\Foundation\Application::instance(); //$app->importHelpers(); /* |-------------------------------------------------------------------------- | Attach Exception handler to Event Listener |-------------------------------------------------------------------------- | | We will attach exception handler to event listener, so that if anything | goes wrong it will catch exceptions. */ $app['app.event'] = function () use($app) { $event = $app->singleton('event', '\\Cygnite\\Base\\EventHandler\\Event'); $event->attach("exception", '\\Cygnite\\Exception\\Handler@handleException'); return $event; }; $config = \Cygnite\Helpers\Config::load(); /** | --------------------------------------------------- | Application booting process | -------------------------------------------------- * * Set configuration and services and boot-up application */ return $app->setConfiguration($config)->boot();
/** * Set up all required configurations * * @internal param $config * @return $this */ public function configure() { //$this->importHelpers(); $this->setPaths(realpath(CYGNITE_BASE . DS . CF_BOOTSTRAP . DS . 'config.paths' . EXT)); //Set up configurations for your awesome application \Cygnite\Helpers\Config::load(); $this->setServices(); return $this; }