2016-07-02 10:58:30 -07:00
|
|
|
<?php
|
|
|
|
|
2016-07-02 17:10:55 -07:00
|
|
|
|
2016-07-03 20:54:55 -07:00
|
|
|
use Sikofitt\Json\ResumeBuilder;
|
|
|
|
use Webmozart\Json\FileNotFoundException;
|
|
|
|
use Webmozart\Json\ValidationFailedException;
|
2016-07-02 17:10:55 -07:00
|
|
|
use Silex\Provider\TwigServiceProvider;
|
2016-07-03 09:05:44 -07:00
|
|
|
use Symfony\Component\Config;
|
2016-07-03 20:54:55 -07:00
|
|
|
use Webmozart\Json\DecodingFailedException;
|
|
|
|
use WhoopsSilex\WhoopsServiceProvider;
|
2016-07-02 10:58:30 -07:00
|
|
|
|
2016-07-03 20:54:55 -07:00
|
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
require_once __DIR__ . '/../app/App.php';
|
|
|
|
|
|
|
|
define ('APP_ROOT', __DIR__ . '/../');
|
|
|
|
define ('SCHEMA_URL', 'https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json');
|
|
|
|
$app = new App();
|
|
|
|
$app->register(new Sikofitt\Config\ConfigServiceProvider(), [
|
|
|
|
'config.path' => $app->getConfDirectory(),
|
|
|
|
]);
|
2016-07-02 10:58:30 -07:00
|
|
|
|
2016-07-03 20:54:55 -07:00
|
|
|
$app->register (new TwigServiceProvider(), [
|
|
|
|
'twig.path' => APP_ROOT . 'app/views',
|
2016-07-02 17:10:55 -07:00
|
|
|
]);
|
2016-07-03 20:54:55 -07:00
|
|
|
$app['conf'] = function ($app) {
|
|
|
|
|
2016-07-03 09:05:44 -07:00
|
|
|
};
|
2016-07-03 20:54:55 -07:00
|
|
|
|
|
|
|
$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) {
|
2016-07-02 17:10:55 -07:00
|
|
|
return new Webmozart\Json\JsonDecoder();
|
|
|
|
};
|
2016-07-03 20:54:55 -07:00
|
|
|
$app['json.encoder'] = function ($app) {
|
2016-07-02 17:10:55 -07:00
|
|
|
return new Webmozart\Json\JsonEncoder();
|
|
|
|
};
|
2016-07-03 20:54:55 -07:00
|
|
|
$app['json.validator'] = function ($app) {
|
2016-07-02 17:10:55 -07:00
|
|
|
return new Webmozart\Json\JsonValidator();
|
|
|
|
};
|
|
|
|
|
2016-07-03 20:54:55 -07:00
|
|
|
$app->get ('/', function () use ($app) {
|
|
|
|
$jsonErrors = [];
|
|
|
|
$resume = new ResumeBuilder($app);
|
|
|
|
$json = $resume->toJson(['array' => 'neat'], ['app' => $app, 'file' => 'resume.json']);
|
|
|
|
//$app['config']->set ('app.name', 'Groovey');
|
2016-07-02 17:10:55 -07:00
|
|
|
|
2016-07-03 20:54:55 -07:00
|
|
|
$decoded = [];
|
|
|
|
$app->config('app.value', 'myvalue');
|
|
|
|
dump($app->config('app'));
|
|
|
|
return $app['twig']->render ('base.html.twig', ['resume' => $decoded, 'errors' => $jsonErrors]);
|
2016-07-02 10:58:30 -07:00
|
|
|
});
|
|
|
|
|
2016-07-03 20:54:55 -07:00
|
|
|
$app->run ();
|