Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Container Laravel Package

league/container

league/container is a lightweight PSR-11 dependency injection container for PHP. Define entries, factories, and autowiring-friendly services to manage application dependencies cleanly, with modern PHP support and solid tooling for testing and analysis.

View on GitHub
Deep Wiki
Context7

layout: post title: Inflectors sections: Removed: removed Migration Guide: migration-guide

Removed

Inflectors have been removed in v6.0. Use afterResolve() or the event system instead.

The inflector subsystem (Container::inflector(), InflectorInterface, InflectorAggregate, InflectorAggregateInterface) has been fully removed. The inflector() method has also been removed from DefinitionContainerInterface.

Migration Guide

Using afterResolve() (recommended)

afterResolve() is a drop-in replacement for the most common inflector patterns. The callback receives the resolved object directly:

Callback form:

<?php

$container->afterResolve(LoggerAwareInterface::class, fn($obj) => $obj->setLogger($logger));

Method invocation:

<?php

$container->afterResolve(LoggerAwareInterface::class, function (object $service) use ($container) {
    $service->setLogger($container->get(Logger::class));
});

Property setting:

<?php

$container->afterResolve(DatabaseAwareInterface::class, function (object $service) use ($container) {
    $service->connection = $container->get(Database::class);
});

Multiple method calls:

<?php

$container->afterResolve(TimestampableInterface::class, function (object $service) {
    $service->setCreatedAt(new DateTime());
    $service->setUpdatedAt(new DateTime());
});

Using the full event API

For advanced use cases such as replacing resolved objects, use listen() directly:

<?php

use League\Container\Event\ServiceResolvedEvent;

$container->listen(ServiceResolvedEvent::class, function (ServiceResolvedEvent $event) {
    $event->setResolved(new CachedRepository($event->getResolved()));
})->forType(RepositoryInterface::class);

See the events documentation for the full API.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony