class Kernel extends SymfonyKernel implements EventSubscriberInterface
{
use MicroKernelTrait;
public function bowtiesAction(): Response
{
return new RedirectResponse('I wear a fez now. Fezzes are cool!');
}
public function dangerousAction(): Response
{
throw new Danger('๐ฅ๐ฅ ๐๐ท ๐ฑ๐บ ๐ฅ๐ฅ');
}
public function onKernelException(ExceptionEvent $event): void
{
if ($event->getThrowable() instanceof Danger) {
$event->setResponse(new Response("๐ด๐ป: It's dangerous to go alone. Take this: ๐ก๏ธ"));
}
}
protected function configureRoutes(RoutingConfigurator $routes): void
{
$routes->add('bowties', '/bowties')->controller('kernel::bowtiesAction');
$routes->add('danger', '/danger')->controller('kernel::dangerousAction');
}
public static function getSubscribedEvents(): array
{
return [KernelEvents::EXCEPTION => 'onKernelException'];
}
}
#php #reactjs developer @Elao. #Lyon
Previous #Symfony core team member.
- Lyon | France
-
10:56
(UTC +01:00) - http://shiningame.ogizanagi.fr
- @ogizanagi
Pinned Loading
-
-
Elao/PhpEnums
Elao/PhpEnums Public๐ฉ Extended PHP 8.1+ enums features & specific integrations with frameworks and libraries
-
StenopePHP/Stenope
StenopePHP/Stenope PublicThe static website generator for Symfony developers
-
StenopePHP/skeleton
StenopePHP/skeleton PublicStarter kit for content-based static site using Stenope
-
Something went wrong, please refresh the page to try again.
If the problem persists, check the GitHub status page or contact support.
If the problem persists, check the GitHub status page or contact support.