-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.php
More file actions
39 lines (27 loc) · 1007 Bytes
/
app.php
File metadata and controls
39 lines (27 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
use Chizu\Context;
use Chizu\Controllers\RootController;
use Exedra\Application;
use Exedra\Routeller\RoutellerRootProvider;
use Exedra\Routing\Group;
use Exedra\Support\Wireman\Wireman;
use Exedra\Support\Wireman\WiremanProvider;
use Twig\Environment;
require_once __DIR__ . '/vendor/autoload.php';
$app = new Application(__DIR__);
$app->provider->add(new RoutellerRootProvider(RootController::class));
$app->provider->add(new WiremanProvider());
$app->factory('runtime.context', Context::class);
$app->factory->intercept('runtime.context', function(Context $context) {
$context->instance(Context::class, $context);
return $context;
});
$app->map->middleware(function(Context $context) {
$loader = new \Twig\Loader\FilesystemLoader($context->app->getRootDir(). '/views');
$twig = new \Twig\Environment($loader, [
// 'cache' => __DIR__ . '/views/cache',
]);
$context->instance(Environment::class, $twig);
return $context->next($context);
});
return $app;