45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?php
|
|
|
|
|
|
use Silex\Provider\TwigServiceProvider;
|
|
use WhoopsSilex\WhoopsServiceProvider;
|
|
use Sikofitt\Config\YamlFileLoader;
|
|
use Symfony\Component\Config;
|
|
require_once __DIR__.'/../vendor/autoload.php';
|
|
|
|
define('APP_ROOT', __DIR__ . '/../');
|
|
define('SCHEMA_URL', 'https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json');
|
|
$app = new Silex\Application();
|
|
|
|
$app->register(new TwigServiceProvider(), [
|
|
'twig.path' => __DIR__.'/../views',
|
|
]);
|
|
$app['config'] = function($app) {
|
|
$configFromFiles = \Noodlehaus\Config::load(APP_ROOT . 'config');
|
|
$defaultOptions = new \Sikofitt\Config($configFromFiles->all());
|
|
return $defaultOptions;
|
|
};
|
|
$app->register(new WhoopsServiceProvider());
|
|
$app->register(new \Silex\Provider\AssetServiceProvider());
|
|
$app->register(new \Silex\Provider\MonologServiceProvider());
|
|
$app->register(new \Silex\Provider\VarDumperServiceProvider());
|
|
$app->register(new \Silex\Provider\HttpKernelServiceProvider());
|
|
$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) {
|
|
|
|
$decoded = $app['json.decoder']->decodeFile(APP_ROOT . 'resume.json', APP_ROOT . 'resume.schema.json');
|
|
dump($app['config']->get('app.debug'));
|
|
return $app['twig']->render('base.html.twig', ['resume' => $decoded]);
|
|
});
|
|
|
|
$app->run();
|