Releases: thephpleague/container
Releases · thephpleague/container
5.2.0
5.2.0
Added
- Event system for hooking into the container lifecycle
- Four event types:
OnDefineEvent,BeforeResolveEvent,DefinitionResolvedEvent,ServiceResolvedEvent - Fluent filtering API:
forType(),forTag(),forId(),where() Container::listen()for registering filtered event listenersContainer::afterResolve()convenience method as a drop-in replacement forinflector()- Lazy event dispatch: events are only created when listeners are registered for that event type
EventDispatcher::hasListenersFor()to check whether listeners exist for a given event typeDefinitionInterface::getTags()for retrieving tags from definitions- Docs: https://container.thephpleague.com/5.x/events/
- Four event types:
Container::getDelegate(string $class)to retrieve a registered delegate container by type
Fixed
- Interface-to-concrete definitions now correctly resolve through the concrete's own registered definition instead of bypassing it via direct reflection (#275, #278)
Definition::resolveClass()now throwsContainerExceptionwith actionable guidance when a class has unsatisfied constructor dependencies, instead of a rawArgumentCountError
Deprecated
Container::inflector()- useContainer::afterResolve()or the event system instead. Will be removed in v6.0.
Changed
DefinitionContainerInterfaceno longer extendsEventAwareContainerInterface(removed)- Shared definitions now receive a
'shared'tag automatically viaaddTag('shared')
Removed
EventAwareContainerInterface- the event system is provided byEventAwareTraiton the concreteContainerclass, not as an interface contract
5.1.0
5.0.1
5.0.1
Fixed
- Fixed a small unreachable code bug
5.0.0
Added
- Ability to overwrite a definition within the container, disabled by default
Changed
- PHP requirement now
>=8.1 - General language modernisation
- General prep for future updates and container compilation
4.2.4
4.2.3
4.2.1
4.2.0
Added
- Support for psr/container 1.1.0.
4.1.2
Fixed
- Fix bug that was causing an error on inflection due to introduced type hint.
4.1.1
4.1.0
Added
- Way to handle non-public controllers safely (@beryllium)