rector/vendor/symplify/symplify-kernel
Tomas Votruba d88782de2e Updated Rector to commit b536a67738
b536a67738 [Scoped][e2e] Fix standalone rule test on scoped build (#2491)
2022-06-14 06:49:40 +00:00
..
config Updated Rector to commit ce1c29184d 2022-06-11 12:27:46 +00:00
src Updated Rector to commit ce1c29184d 2022-06-11 12:27:46 +00:00
tests/ContainerBuilderFactory Updated Rector to commit ce1c29184d 2022-06-11 12:27:46 +00:00
README.md Rector 0.12.14 2022-01-25 19:33:08 +00:00
composer.json Updated Rector to commit b536a67738 2022-06-14 06:49:40 +00:00
phpunit.xml Rector 0.12.14 2022-01-25 19:33:08 +00:00

README.md

Symplify Kernel

Downloads total

Do you use Symfony Kernel, but not for PHP projects?

Use Symfony Kernel for:

  • light Symfony Console Apps without Http
  • faster and easy-to-setup tests
  • merging of array parameters in 2 configs

Install

composer require symplify/symplify-kernel --dev

Usage

1. Light Kernel for Symfony CLI Apps

use Psr\Container\ContainerInterface;
use Symplify\SymplifyKernel\ContainerBuilderFactory;

final class MonorepoBuilderKernel
{
    /**
     * @param string[] $configFiles
     */
    public function createFromConfigs(array $configFiles): ContainerInterface
    {
        // local config here
        $configFiles[] = __DIR__ . '/../../config/config.php';

        $containerBuilderFactory = new ContainerBuilderFactory();
        $containerBuilder = $containerBuilderFactory->create($configFiles, [], []);

        // build the container
        $containerBuilder->compile();

        return $containerBuilder;
    }
}

Then use in your bin/app.php file:

$easyCIKernel = new MonorepoBuilderKernel();
$easyCIKernel->createFromConfigs([__DIR__ . '/config/config.php']);

$container = $easyCIKernel->getContainer();

/** @var Application $application */
$application = $container->get(Application::class);
exit($application->run());

That's it!


Report Issues

In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker

Contribute

The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.