@@ -34,7 +34,7 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
34
34
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
35
35
use Symfony\Component\Routing\Attribute\Route;
36
36
37
- require __DIR__.'/vendor/autoload .php';
37
+ require_once dirname( __DIR__) .'/vendor/autoload_runtime .php';
38
38
39
39
class Kernel extends BaseKernel
40
40
{
@@ -57,11 +57,9 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
57
57
}
58
58
}
59
59
60
- $kernel = new Kernel('dev', true);
61
- $request = Request::createFromGlobals();
62
- $response = $kernel->handle($request);
63
- $response->send();
64
- $kernel->terminate($request, $response);
60
+ return static function (array $context) {
61
+ return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
62
+ }
65
63
66
64
.. code-block :: php
67
65
@@ -73,7 +71,7 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
73
71
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
74
72
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
75
73
76
- require __DIR__.'/vendor/autoload .php';
74
+ require_once dirname( __DIR__) .'/vendor/autoload_runtime .php';
77
75
78
76
class Kernel extends BaseKernel
79
77
{
@@ -100,11 +98,9 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
100
98
}
101
99
}
102
100
103
- $kernel = new Kernel('dev', true);
104
- $request = Request::createFromGlobals();
105
- $response = $kernel->handle($request);
106
- $response->send();
107
- $kernel->terminate($request, $response);
101
+ return static function (array $context) {
102
+ return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
103
+ }
108
104
109
105
That's it! To test it, start the :doc: `Symfony Local Web Server
110
106
</setup/symfony_server>`:
0 commit comments