symplify/symplify-kernel
Shared kernel and infrastructure for Symplify tools. Provides common console/app bootstrapping, configuration loading, service container wiring, and utilities to build consistent PHP CLI applications and packages on top of Symplify components.
Do you use Symfony Kernel, but not for PHP projects?
Use Symfony Kernel for:
composer require symplify/symplify-kernel --dev
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!
In case you are experiencing a bug or want to request a new feature head over to the Symplify monorepo issue tracker
The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on symplify/symplify.
How can I help you explore Laravel packages today?