Skip to content

Commit a242e43

Browse files
committed
More simplifications
1 parent 49b2f6c commit a242e43

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

configuration/micro_kernel_trait.rst

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
3434
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
3535
use Symfony\Component\Routing\Attribute\Route;
3636
37-
require __DIR__.'/vendor/autoload.php';
37+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
3838
3939
class Kernel extends BaseKernel
4040
{
@@ -57,11 +57,9 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
5757
}
5858
}
5959
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+
}
6563
6664
.. code-block:: php
6765
@@ -73,7 +71,7 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
7371
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
7472
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
7573
76-
require __DIR__.'/vendor/autoload.php';
74+
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
7775
7876
class Kernel extends BaseKernel
7977
{
@@ -100,11 +98,9 @@ Next, create an ``index.php`` file that defines the kernel class and runs it:
10098
}
10199
}
102100
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+
}
108104
109105
That's it! To test it, start the :doc:`Symfony Local Web Server
110106
</setup/symfony_server>`:

0 commit comments

Comments
 (0)