Пример #1
0
 /**
  * Creates a new WURFL Configuration object from $configFilePath
  *
  * @param string $configFilePath Complete filename of configuration file
  *
  * @throws \InvalidArgumentException
  */
 public function __construct($configFilePath)
 {
     if (!file_exists($configFilePath)) {
         throw new \InvalidArgumentException('The configuration file ' . $configFilePath . ' does not exist.');
     }
     $this->configFilePath = $configFilePath;
     $this->configurationFileDir = dirname($this->configFilePath);
     $configLoader = new ConfigLoader($this->configFilePath);
     $this->initialize($configLoader->all());
 }
Пример #2
0
 * We use the composer autoloader for everything
 */
require APPLICATION_PATH . "/../vendor/autoload.php";
$dotenv = new Dotenv\Dotenv(APPLICATION_PATH . '/../');
$dotenv->load();
if (!defined('SLIM_MODE')) {
    $mode = getenv('SLIM_MODE') ? getenv('SLIM_MODE') : 'production';
    define('SLIM_MODE', $mode);
}
/**
 * init a session
 */
session_start();
$config = new Config(array(APPLICATION_PATH . '/app/config/global.php', APPLICATION_PATH . '/app/config/' . SLIM_MODE . '.php'));
// Create Slim app
$app = new App(['settings' => $config->all()]);
// middleware setup
$app->add(new TrailingSlash(false));
// true adds the trailing slash (false removes it)
// Fetch DI Container
$container = $app->getContainer();
/*
 * set up Monolog
 */
$log = new Logger('GraphStoryCom');
$log->pushHandler(new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $container->get('settings')['monolog.level']));
$container['logger'] = $log;
/**
 * set Twig parser options
 *
 * @param \Interop\Container\ContainerInterface $c