Example #1
0
 /**
  * Initialize the app
  */
 static function init()
 {
     // Load configuration
     if (is_file('config.php')) {
         self::$_config = (require 'config.php');
     } else {
         throw new Exception('No config.php file found.');
     }
     // Initialize Composer autoloader
     require_once 'vendor/autoload.php';
     // Initialize framework
     self::$_router = Base::instance();
     self::$_router->mset(['AUTOLOAD' => 'app/', 'ESCAPE' => false, 'PACKAGE' => 'alanaktion/gh-issues']);
     self::$_router->mset(self::$_config);
     // Initialize database connection and query builder
     self::$_db = new DB\SQL('mysql:host=' . self::$_config['db']['host'] . ';port=3306;dbname=' . self::$_config['db']['database'], self::$_config['db']['username'], self::$_config['db']['password']);
     // Initialize routes
     require_once 'routes.php';
 }
Example #2
0
File: app.php Project: svlt/back
 /**
  * Initialize the app
  */
 static function init()
 {
     // Load configuration
     if (is_file('config.php')) {
         self::$_config = (require 'config.php');
     } else {
         throw new Exception('No config.php file found.');
     }
     // Initialize Composer autoloader
     require_once 'vendor/autoload.php';
     // Initialize framework
     self::$_router = Base::instance();
     self::$_router->mset(['AUTOLOAD' => 'app/', 'ESCAPE' => false, 'PACKAGE' => 'svlt/back', 'CORS.origin' => '*']);
     // Initialize database connection and query builder
     self::$_qb = new Pixie\Connection('mysql', ['driver' => 'mysql'] + self::$_config['db'], 'QB');
     self::$_db = new SQL(QB::pdo(), 'mysql:host=' . self::$_config['db']['host'] . ';port=3306;dbname=' . self::$_config['db']['database']);
     // Initialize routes
     require_once 'routes.php';
 }