38 lines
900 B
PHP
38 lines
900 B
PHP
<?php
|
|
|
|
|
|
use Silex\Provider\TwigServiceProvider;
|
|
use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader;
|
|
use Symfony\Component\Yaml\Yaml;
|
|
use WhoopsSilex\WhoopsServiceProvider;
|
|
|
|
require_once __DIR__.'/../vendor/autoload.php';
|
|
|
|
define('APP_ROOT', __DIR__ . '/../');
|
|
|
|
$app = new Silex\Application();
|
|
|
|
$app->register(new TwigServiceProvider(), [
|
|
'twig.path' => __DIR__.'/../views',
|
|
]);
|
|
$app->register(new WhoopsServiceProvider());
|
|
|
|
$app['json.decoder'] = function($app) {
|
|
return new Webmozart\Json\JsonDecoder();
|
|
};
|
|
$app['json.encoder'] = function($app) {
|
|
return new Webmozart\Json\JsonEncoder();
|
|
};
|
|
$app['json.validator'] = function($app) {
|
|
return new Webmozart\Json\JsonValidator();
|
|
};
|
|
|
|
$app->get('/', function() use($app) {
|
|
|
|
$yaml = Yaml::parse(file_get_contents(APP_ROOT . 'yaml.yml'));
|
|
dump($yaml);
|
|
return $app['twig']->render('base.html.twig');
|
|
});
|
|
|
|
$app->run();
|