The package supports PHP 8.1+ and Symfony DependencyInjection 5.3 through 8.x.
Symfony 8 requires PHP 8.4 or newer. Existing new Container(), service
providers, aliases and reflection-based resolution continue to work.
For new services, configure a Symfony ContainerBuilder directly and pass it
to the compatibility container:
use Nip\Container\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
$builder = new ContainerBuilder();
$builder->register(MyService::class)->setAutowired(true)->setPublic(true);
$container = new Container($builder);
// Configure and compile the builder with Symfony's normal APIs when needed.
$builder->compile();
$service = $container->get(MyService::class);getSymfonyContainer() exposes the underlying Symfony container;
setSymfonyContainer() remains available for existing integrations. A
Symfony container can also be supplied to the constructor. Symfony definitions,
aliases and compiler passes should be configured on a ContainerBuilder before
compilation. Symfony's normal visibility and compiled-container restrictions
apply. The legacy providers, reflection fallback and value wrapping belong to
the compatibility container and are not available through the Symfony
container directly.
