resume/web/index.php

38 lines
900 B
PHP
Raw Normal View History

2016-07-02 10:58:30 -07:00
<?php
2016-07-02 17:10:55 -07:00
use Silex\Provider\TwigServiceProvider;
use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader;
use Symfony\Component\Yaml\Yaml;
use WhoopsSilex\WhoopsServiceProvider;
2016-07-02 10:58:30 -07:00
require_once __DIR__.'/../vendor/autoload.php';
2016-07-02 17:10:55 -07:00
define('APP_ROOT', __DIR__ . '/../');
2016-07-02 10:58:30 -07:00
$app = new Silex\Application();
2016-07-02 17:10:55 -07:00
$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');
2016-07-02 10:58:30 -07:00
});
$app->run();