Exemple #1
0
         return true;
     }
 });
 // 2. load the Core class that includes an autoloader
 require "framework/core.php";
 Framework\Core::initialize();
 // plugins
 $path = APP_PATH . "/application/plugins";
 $iterator = new DirectoryIterator($path);
 foreach ($iterator as $item) {
     if (!$item->isDot() && $item->isDir()) {
         include $path . "/" . $item->getFilename() . "/initialize.php";
     }
 }
 // 3. load and initialize the Configuration class
 $configuration = new Framework\Configuration(array("type" => "ini"));
 Framework\Registry::set("configuration", $configuration->initialize());
 // 4. load and initialize the Database class – does not connect
 $database = new Framework\Database();
 Framework\Registry::set("database", $database->initialize());
 // 5. load and initialize the Cache class – does not connect
 $cache = new Framework\Cache();
 Framework\Registry::set("cache", $cache->initialize());
 // 6. load and initialize the Session class
 $session = new Framework\Session();
 Framework\Registry::set("session", $session->initialize());
 // 7. load the Router class and provide the url + extension
 $router = new Framework\Router(array("url" => isset($_GET["url"]) ? $_GET["url"] : "home/index", "extension" => !empty($_GET["extension"]) ? $_GET["extension"] : "html"));
 Framework\Registry::set("router", $router);
 // include custom routes
 include "public/routes.php";
Exemple #2
0
<?php

require_once 'autoloader.php';
try {
    $conf = new Framework\Configuration(array('type' => 'ini'));
    $driver = $conf->initialize();
    $driver->parse('_configuration');
    echo '<pre>';
    print_r($driver->parsed);
    echo '</pre>';
} catch (Exception $e) {
    echo $e->getMessage();
}