Example #1
0
<?php

/**
 * easy.php : Ligne de commande pour le framework
 */
/*
 * On charge l'autoloader de composer pour avoir accès à
 * toutes les classes de l'application et des bibliothèques
 */
use PHQ\Base\Application;
use PHQ\Routing\Router;
use PHQ\Translate\Translate;
require __DIR__ . '/../vendor/autoload.php';
function translate($key)
{
    return Translate::_($key);
}
function url($name, array $params = [])
{
    return Router::url($name, $params);
}
try {
    $app = new Application();
    $app->initConfig();
    $app->initDatabase();
    $app->runCommand();
} catch (Exception $e) {
    exit($e->getMessage());
}
Example #2
0
    return Translate::_($key);
}
function url($name, array $params = [])
{
    return Router::url($name, $params);
}
function post($base = [])
{
    $post = Session::get('post');
    Session::unset('post');
    $post = empty($post) ? [] : $post;
    $post = array_merge($base, $post);
    return $post;
}
try {
    $app = new Application();
    $app->initConfig();
    $app->initDatabase();
    $app->initCookies();
    $app->initHttp();
    $app->initLang();
    if (Config::get('app')->debug) {
        $files = glob(Config::get('folder')->cache['views'] . '/*');
        // get all file names
        foreach ($files as $file) {
            // iterate files
            if (is_file($file)) {
                unlink($file);
                // delete file
            }
        }