File: app/bootstrap/start.php

Recommend this page to a friend!
  Classes of ikhsan  >  Slim Starter  >  app/bootstrap/start.php  >  Download  
File: app/bootstrap/start.php
Role: Application script
Content type: text/plain
Description: application bootstrapper
Class: Slim Starter
Build MVC Web applications based on Slim framework
Author: By
Last change:
Date: 6 years ago
Size: 1,798 bytes
 

Contents

Download
<?php

session_cache_limiter
(false);
session_start();

define('ROOT_PATH' , __DIR__.'/../../');
define('VENDOR_PATH', __DIR__.'/../../vendor/');
define('APP_PATH' , __DIR__.'/../../app/');
define('MODULE_PATH', __DIR__.'/../../app/modules/');
define('PUBLIC_PATH', __DIR__.'/../../public/');

require
VENDOR_PATH.'autoload.php';

/**
 * Load the configuration
 */
$config = array(
   
'path.root' => ROOT_PATH,
   
'path.public' => PUBLIC_PATH,
   
'path.app' => APP_PATH,
   
'path.module' => MODULE_PATH
);

foreach (
glob(APP_PATH.'config/*.php') as $configFile) {
    require
$configFile;
}

/** Merge cookies config to slim config */
if(isset($config['cookies'])){
    foreach(
$config['cookies'] as $configKey => $configVal){
       
$config['slim']['cookies.'.$configKey] = $configVal;
    }
}

/**
 * Initialize Slim and SlimStarter application
 */
$app = new \Slim\Slim($config['slim']);
$starter = new \SlimStarter\Bootstrap($app);

$starter->setConfig($config);

/**
 * if called from the install script, disable all hooks, middlewares, and database init
 */
if(!defined('INSTALL')){
   
/** boot up SlimStarter */
   
$starter->boot();

   
/** Setting up Slim hooks and middleware */
   
require APP_PATH.'bootstrap/app.php';

   
/** registering modules */
   
foreach (glob(APP_PATH.'modules/*') as $module) {
       
$className = basename($module);
       
$moduleBootstrap = "\\$className\\Initialize";

       
$app->module->register(new $moduleBootstrap);
    }

   
$app->module->boot();

   
/** Start the route */
   
require APP_PATH.'routes.php';
}else{
   
/** disregard sentry configuration on install */
   
$config['aliases']['Sentry'] = 'Cartalyst\Sentry\Facades\Native\Sentry';

   
$starter->bootFacade($config['aliases']);
}

return
$starter;


For more information send a message to info at phpclasses dot org.