TwigBundle example

class Kernel extends BaseKernel
{
    use MicroKernelTrait;

    /** * @return BundleInterface[] */
    public function registerBundles(): array
    {
        return [
            new FrameworkBundle(),
            new TwigBundle(),
        ];
    }

    public function getProjectDir(): string
    {
        return __DIR__;
    }

    public function getLogDir(): string
    {
        return $this->getCacheDir();
    }

        parent::boot();
        $this->ensureComposerHomeVarIsSet();
    }

    /** * @return \Generator<BundleInterface> */
    public function registerBundles(): \Generator
    {
        yield new FrameworkBundle();
        yield new TwigBundle();
        yield new Installer();
    }

    public function getProjectDir(): string
    {
        $r = new \ReflectionObject($this);

        /** @var string $dir */
        $dir = $r->getFileName();
        if (!file_exists($dir)) {
            throw new \LogicException(sprintf('Cannot auto-detect project dir for kernel of class "%s".', $r->name));
        }
Home | Imprint | This part of the site doesn't use cookies.