forked from hiephm/magento2-web-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
28 lines (21 loc) · 737 Bytes
/
index.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
<?php
require 'vendor/autoload.php';
define('CONSOLE_BP', __DIR__);
$app = new \Slim\App();
// Get container
$container = $app->getContainer();
// Register component on container
$container['view'] = function ($container) {
$view = new \Slim\Views\Twig('src/twig/view', [
'cache' => false
]);
$view->addExtension(new \Slim\Views\TwigExtension(
$container['router'],
$container['request']->getUri()
));
return $view;
};
$app->get('/', '\M2Console\Controllers\Console')->setName('index');
$app->post('/code_runner', '\M2Console\Controllers\CodeRunner')->setName('code_runner');
$app->post('/code_generator', '\M2Console\Controllers\CodeGenerator')->setName('code_generator');
$app->run();