85 lines
2.4 KiB
PHP
85 lines
2.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pcm\BadgeBundle\Dev;
|
|
|
|
use Pcm\BadgeBundle\PcmBadgeBundle;
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
|
use Symfony\Bundle\TwigBundle\TwigBundle;
|
|
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
|
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
|
use Symfony\UX\Icons\UXIconsBundle;
|
|
use Symfony\UX\TwigComponent\TwigComponentBundle;
|
|
|
|
final class Kernel extends BaseKernel
|
|
{
|
|
use MicroKernelTrait;
|
|
|
|
public function registerBundles(): iterable
|
|
{
|
|
return [
|
|
new FrameworkBundle(),
|
|
new TwigBundle(),
|
|
new TwigComponentBundle(),
|
|
new UXIconsBundle(),
|
|
new PcmBadgeBundle(),
|
|
];
|
|
}
|
|
|
|
public function getProjectDir(): string
|
|
{
|
|
return \dirname(__DIR__);
|
|
}
|
|
|
|
public function getCacheDir(): string
|
|
{
|
|
return $this->getProjectDir().'/var/cache/'.$this->environment;
|
|
}
|
|
|
|
public function getLogDir(): string
|
|
{
|
|
return $this->getProjectDir().'/var/log';
|
|
}
|
|
|
|
private function configureContainer(ContainerConfigurator $container): void
|
|
{
|
|
$container->extension('framework', [
|
|
'secret' => 'dev',
|
|
'router' => ['utf8' => true],
|
|
'test' => false,
|
|
'http_method_override' => false,
|
|
'handle_all_throwables' => true,
|
|
'php_errors' => ['log' => true],
|
|
]);
|
|
|
|
$container->extension('twig', [
|
|
'default_path' => $this->getProjectDir().'/templates',
|
|
]);
|
|
|
|
// Default config for the bundle. Tweak to preview different base classes.
|
|
$container->extension('pcm_badge', []);
|
|
|
|
// Fetch icons on-demand from iconify.design so no JS toolchain is needed.
|
|
$container->extension('ux_icons', [
|
|
'icon_dir' => '%kernel.project_dir%/var/icons',
|
|
'iconify' => ['enabled' => true, 'on_demand' => true],
|
|
]);
|
|
|
|
$container->services()
|
|
->defaults()
|
|
->autowire()
|
|
->autoconfigure()
|
|
->load(__NAMESPACE__.'\\Controller\\', __DIR__.'/Controller/')
|
|
->public()
|
|
;
|
|
}
|
|
|
|
private function configureRoutes(RoutingConfigurator $routes): void
|
|
{
|
|
$routes->import(__DIR__.'/Controller/', 'attribute');
|
|
}
|
|
}
|