Add showcase code

This commit is contained in:
brabli
2026-04-30 12:22:50 +01:00
parent 93258abd38
commit 5f1404d77c
4 changed files with 281 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
<?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');
}
}