-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
34 lines (26 loc) · 844 Bytes
/
bootstrap.php
File metadata and controls
34 lines (26 loc) · 844 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
<?php
require_once 'vendor/autoload.php';
$app = new Slim\App();
$containter = $app->getContainer();
$routeParser = new Nueve\RouteManager\RouteParser($container->get('router'), $container);
$routeConfig = require_once 'config/routes.php';
$routes = [];
foreach ($routeConfig as $name => $route) {
if (!is_array($route) && !isset($route['pattern'])) {
continue;
}
$group = null;
$route['name'] = $name;
array_walk($routes, function ($value) use (&$group, $name) {
$length = strlen($value['name']);
if (substr($name, 0, $length) === $value['name']) {
$group = $value;
}
});
if (!empty($group)) {
$route['pattern'] = $group['pattern'] . $route['pattern'];
$route = array_merge($group, $route);
}
$routeParser->addRoute($route);
}
return $app;