Example #1
0
<?php

/* Create application instance and set it as default container */
$app = new Ape\Application();
$app->instance('app', $app);
$app->alias('app', 'Illuminate\\Container\\Container');
Ape\Facades\Facade::setFacadeApplication($app);
$app->instance('config', 'Ape\\Facades\\Config', true);
$app->buildEnvironment(function () {
    if (isset($_ENV['DEVZ'])) {
        // development environment
        return array('dev', 'dev/' . $_ENV['DEVZ']);
    }
    if ($_SERVER['SERVER_ADDR'] == '10.0.0.13') {
        return 'pi';
    }
    return 'prod';
});
// a.
//  load generic config
//  detect environment
//  load environment-specific config
//
// or
//
// b.
//  detect environment
//  try to load pre-cached config
//  if fail load generic config and environment-specific, then write down compiled one
if (Config::get('debug', false)) {
    // register whoops handler
Example #2
0
File: App.php Project: pinepain/ape
 /**
  * Register an existing instance as shared in the container.
  *
  * @param  string $abstract
  * @param  mixed  $instance
  *
  * @return void
  */
 public static function instance($abstract, $instance)
 {
     return Ape\Application::instance($abstract, $instance);
 }