-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.php
34 lines (24 loc) · 894 Bytes
/
app.php
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
<?php
declare(strict_types=1);
namespace Sandbox;
use Monolog\Handler\ErrorLogHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Pimple\Psr11\Container;
use Sandbox\Controller\PingController;
use Sandbox\Controller\UrlController;
use Slim\Factory\AppFactory;
require_once(__DIR__ . '/vendor/autoload.php');
$pimpleContainer = new \Pimple\Container(['logger' => function ($c) {
$logger = new Logger('sandbox');
$logger->pushHandler(new ErrorLogHandler());
$logger->pushHandler(new StreamHandler(__DIR__ . '/log/sandbox.log'));
return $logger;
}]);
$container = new Container($pimpleContainer);
$app = AppFactory::createFromContainer($container);
$urlController = new UrlController($container->get('logger'));
$urlController->register($app);
$pingController = new PingController($container->get('logger'));
$pingController->register($app);
$app->run();