21 KiB
CHANGELOG
7.3
- Make
#[AsTaggedItem]repeatable - Support
@>as a shorthand for!service_closurein yaml files - Don't skip classes with private constructor when autodiscovering
- Add
Definition::addResourceTag()andContainerBuilder::findTaggedResourceIds()for auto-configuration of classes excluded from the service container - Accept multiple auto-configuration callbacks for the same attribute class
- Leverage native lazy objects when possible for lazy services
- Add
whenargument to#[AsAlias]
7.2
- Deprecate
!taggedtag, use!tagged_iteratorinstead - Add a
ContainerBuilder::registerChild()shortcut method for registering child definitions - Add support for
key-typeinXmlFileLoader - Enable non-empty parameters with
ParameterBag::cannotBeEmpty()andContainerBuilder::parameterCannotBeEmpty()methods - Resolve parameters found in index attribute of service tags
7.1
- Add
CheckAliasValidityPassto check service compatibility with aliased interface - Add argument
$prependtoContainerConfigurator::extension()to prepend the configuration instead of appending it - Have
ServiceLocatorimplementServiceCollectionInterface - Add
#[Lazy]attribute as shortcut for#[Autowire(lazy: [bool|string])]and#[Autoconfigure(lazy: [bool|string])] - Add
#[AutowireMethodOf]attribute to autowire a method of a service as a callable - Make
ContainerBuilder::registerAttributeForAutoconfiguration()propagate to attribute classes that extend the registered class - Add argument
$prependtoFileLoader::construct()to prepend loaded configuration instead of appending it - [BC BREAK] When used in the
prependExtension()method, theContainerConfigurator::import()method now prepends the configuration instead of appending it - Cast env vars to null or bool when referencing them using
#[Autowire(env: '...')]depending on the signature of the corresponding parameter - Add
#[AutowireInline]attribute to allow service definition at the class level - Add
StaticEnvVarLoader
7.0
- Remove
#[MapDecorated], use#[AutowireDecorated]instead - Remove
ProxyHelper, useSymfony\Component\VarExporter\ProxyHelperinstead - Remove
ReferenceSetArgumentTrait - Remove support of
@requiredannotation, use theSymfony\Contracts\Service\Attribute\Requiredattribute instead - Require explicit argument when calling
ContainerAwareTrait::setContainer() - Remove
PhpDumperoptionsinline_factories_parameterandinline_class_loader_parameter, use optionsinline_factoriesandinline_class_loaderinstead - Parameter names of
ParameterBagcannot be numerics - Remove
ContainerAwareInterfaceandContainerAwareTrait, use dependency injection instead - Add argument
$idand$asGhostObjecttoDumperInterface::isProxyCandidate()andgetProxyCode() - Add argument
$sourcetoFileLoader::registerClasses()
6.4
- Allow using
#[Target]with no arguments to state that a parameter must match a named autowiring alias - Deprecate
ContainerAwareInterfaceandContainerAwareTrait, use dependency injection instead - Add
definedenv var processor that returnstruefor defined and neither null nor empty env vars - Add
#[AutowireLocator]and#[AutowireIterator]attributes - Add
urlencodeenv var processor that url encodes a string value
6.3
- Add options
inline_factoriesandinline_class_loadertoPhpDumper::dump() - Deprecate
PhpDumperoptionsinline_factories_parameterandinline_class_loader_parameter - Add
RemoveBuildParametersPass, which removes parameters starting with a dot during compilation - Add support for nesting autowiring-related attributes into
#[Autowire(...)] - Deprecate undefined and numeric keys with
service_locatorconfig - Fail if Target attribute does not exist during compilation
- Enable deprecating parameters with
ContainerBuilder::deprecateParameter() - Add
#[AsAlias]attribute to tell under which alias a service should be registered or to use the implemented interface if no parameter is given - Allow to trim XML service parameters value by using
trim="true"attribute - Allow extending the
Autowireattribute - Add
#[Exclude]to skip autoregistering a class - Add support for generating lazy closures
- Add support for autowiring services as closures using
#[AutowireCallable]or#[AutowireServiceClosure] - Add support for
#[Autowire(lazy: true|class-string)] - Make it possible to cast callables into single-method interfaces
- Deprecate
#[MapDecorated], use#[AutowireDecorated]instead - Deprecate the
@requiredannotation, use theSymfony\Contracts\Service\Attribute\Requiredattribute instead - Add
constructoroption to services declaration and to#[Autoconfigure]
6.2
- Use lazy-loading ghost objects and virtual proxies out of the box
- Add arguments
&$asGhostObjectand$idto LazyProxy'sDumperInterfaceto allow using ghost objects for lazy loading services - Add
enumenv var processor - Add
shuffleenv var processor - Allow #[When] to be extended
- Change the signature of
ContainerAwareInterface::setContainer()tosetContainer(?ContainerInterface) - Deprecate calling
ContainerAwareTrait::setContainer()without arguments - Deprecate using numeric parameter names
- Add support for tagged iterators/locators
excludeoption to the xml and yaml loaders/dumpers - Allow injecting
string $envinto php config closures - Add
excludeSelfparameter toTaggedIteratorArgumentwith default value totrueto control whether the referencing service should be automatically excluded from the iterator
6.1
- Add
#[MapDecorated]attribute telling to which parameter the decorated service should be mapped in a decorator - Add
#[AsDecorator]attribute to make a service decorates another - Add
$excludetoTaggedIteratorandTaggedLocatorattributes - Add
$excludetotagged_iteratorandtagged_locatorconfigurator - Add an
envfunction to the expression language provider - Add an
Autowireattribute to tell a parameter how to be autowired - Allow using expressions as service factories
- Add argument type
closureto help passing closures to services - Deprecate
ReferenceSetArgumentTrait - Add
AbstractExtensionclass for DI configuration/definition on a single file
6.0
- Remove
Definition::setPrivate()andAlias::setPrivate(), usesetPublic()instead - Remove
inline()in favor ofinline_service()andref()in favor ofservice()when using the PHP-DSL - Remove
Definition::getDeprecationMessage(), useDefinition::getDeprecation()instead - Remove
Alias::getDeprecationMessage(), useAlias::getDeprecation()instead - Remove the
Psr\Container\ContainerInterfaceandSymfony\Component\DependencyInjection\ContainerInterfacealiases of theservice_containerservice
5.4
- Add
$defaultIndexMethodand$defaultPriorityMethodtoTaggedIteratorandTaggedLocatorattributes - Add
service_closure()to the PHP-DSL - Add support for autoconfigurable attributes on methods, properties and parameters
- Make auto-aliases private by default
- Add support for autowiring union and intersection types
5.3
- Add
ServicesConfigurator::remove()in the PHP-DSL - Add
%env(not:...)%processor to negate boolean values - Add support for loading autoconfiguration rules via the
#[Autoconfigure]and#[AutoconfigureTag]attributes on PHP 8 - Add
#[AsTaggedItem]attribute for defining the index and priority of classes found in tagged iterators/locators - Add autoconfigurable attributes
- Add support for autowiring tagged iterators and locators via attributes on PHP 8
- Add support for per-env configuration in XML and Yaml loaders
- Add
ContainerBuilder::willBeAvailable()to help with conditional configuration - Add support an integer return value for default_index_method
- Add
#[When(env: 'foo')]to skip autoregistering a class when the env doesn't match - Add
env()andEnvConfiguratorin the PHP-DSL - Add support for
ConfigBuilderin thePhpFileLoader - Add
ContainerConfigurator::env()to get the current environment - Add
#[Target]to tell how a dependency is used and hint named autowiring aliases
5.2.0
- added
param()andabstract_arg()in the PHP-DSL - deprecated
Definition::setPrivate()andAlias::setPrivate(), usesetPublic()instead - added support for the
#[Required]attribute
5.1.0
- deprecated
inline()in favor ofinline_service()andref()in favor ofservice()when using the PHP-DSL - allow decorators to reference their decorated service using the special
.innerid - added support to autowire public typed properties in php 7.4
- added support for defining method calls, a configurator, and property setters in
InlineServiceConfigurator - added possibility to define abstract service arguments
- allowed mixing "parent" and instanceof-conditionals/defaults/bindings
- updated the signature of method
Definition::setDeprecated()toDefinition::setDeprecation(string $package, string $version, string $message) - updated the signature of method
Alias::setDeprecated()toAlias::setDeprecation(string $package, string $version, string $message) - updated the signature of method
DeprecateTrait::deprecate()toDeprecateTrait::deprecation(string $package, string $version, string $message) - deprecated the
Psr\Container\ContainerInterfaceandSymfony\Component\DependencyInjection\ContainerInterfacealiases of theservice_containerservice, configure them explicitly instead - added class
Symfony\Component\DependencyInjection\Dumper\Preloaderto help with preloading on PHP 7.4+ - added tags
container.preload/.no_preloadto declare extra classes to preload/services to not preload - allowed loading and dumping tags with an attribute named "name"
- deprecated
Definition::getDeprecationMessage(), useDefinition::getDeprecation()instead - deprecated
Alias::getDeprecationMessage(), useAlias::getDeprecation()instead - added support of PHP8 static return type for withers
- added
AliasDeprecatedPublicServicesPassto deprecate public services to private
5.0.0
- removed support for auto-discovered extension configuration class which does not implement
ConfigurationInterface - removed support for non-string default env() parameters
- moved
ServiceSubscriberInterfaceto theSymfony\Contracts\Servicenamespace - removed
RepeatedPassandRepeatablePassInterface - removed support for short factory/configurator syntax from
YamlFileLoader - removed
ResettableContainerInterface, useResetInterfaceinstead - added argument
$returnsClonetoDefinition::addMethodCall() - removed
tagged, usetagged_iteratorinstead
4.4.0
- added
CheckTypeDeclarationsPassto check injected parameters type during compilation - added support for opcache.preload by generating a preloading script in the cache folder
- added support for dumping the container in one file instead of many files
- deprecated support for short factories and short configurators in Yaml
- added
tagged_iteratoralias fortaggedwhich might be deprecated in a future version - deprecated passing an instance of
Symfony\Component\DependencyInjection\Parameteras class name toSymfony\Component\DependencyInjection\Definition - added support for binding iterable and tagged services
- made singly-implemented interfaces detection be scoped by file
- added ability to define a static priority method for tagged service
- added support for improved syntax to define method calls in Yaml
- made the
%env(base64:...)%processor able to decode base64url - added ability to choose behavior of decorations on non existent decorated services
4.3.0
- added
%env(trim:...)%processor to trim a string value - added
%env(default:param_name:...)%processor to fallback to a parameter or to null when using%env(default::...)% - added
%env(url:...)%processor to convert a URL or DNS into an array of components - added
%env(query_string:...)%processor to convert a query string into an array of key values - added support for deprecating aliases
- made
ContainerParametersResourcefinal and not implementSerializableanymore - added
ReverseContainer: a container that turns services back to their ids - added ability to define an index for a tagged collection
- added ability to define an index for services in an injected service locator argument
- made
ServiceLocatorimplementServiceProviderInterface - deprecated support for non-string default env() parameters
- added
%env(require:...)%processor torequire()a PHP file and use the value returned from it
4.2.0
- added
ContainerBuilder::registerAliasForArgument()to support autowiring by type+name - added support for binding by type+name
- added
ServiceSubscriberTraitto ease implementingServiceSubscriberInterfaceusing methods' return types - added
ServiceLocatorArgumentand!service_locatorconfig tag for creating optimized service-locators - added support for autoconfiguring bindings
- added
%env(key:...)%processor to fetch a specific key from an array - deprecated
ServiceSubscriberInterface, use the same interface from theSymfony\Contracts\Servicenamespace instead - deprecated
ResettableContainerInterface, useSymfony\Contracts\Service\ResetInterfaceinstead
4.1.0
- added support for variadics in named arguments
- added PSR-11
ContainerBagInterfaceand itsContainerBagimplementation to access parameters as-a-service - added support for service's decorators autowiring
- deprecated the
TypedReference::canBeAutoregistered()andTypedReference::getRequiringClass()methods - environment variables are validated when used in extension configuration
- deprecated support for auto-discovered extension configuration class which does not implement
ConfigurationInterface
4.0.0
-
Relying on service auto-registration while autowiring is not supported anymore. Explicitly inject your dependencies or create services whose ids are their fully-qualified class name.
Before:
namespace App\Controller; use App\Mailer; class DefaultController { public function __construct(Mailer $mailer) { // ... } // ... }services: App\Controller\DefaultController: autowire: trueAfter:
// same PHP codeservices: App\Controller\DefaultController: autowire: true # or # App\Controller\DefaultController: # arguments: { $mailer: "@App\Mailer" } App\Mailer: autowire: true -
removed autowiring services based on the types they implement
-
added a third
$methodNameargument to thegetProxyFactoryCode()method of theDumperInterface -
removed support for autowiring types
-
removed
Container::isFrozen -
removed support for dumping an ucompiled container in
PhpDumper -
removed support for generating a dumped
Containerwithout populating the method map -
removed support for case insensitive service identifiers
-
removed the
DefinitionDecoratorclass, replaced byChildDefinition -
removed the
AutowireServiceResourceclass and relatedAutowirePass::createResourceForClass()method -
removed
LoggingFormatter,Compiler::getLoggingFormatter()andaddLogMessage()class and methods, use theContainerBuilder::log()method instead -
removed
FactoryReturnTypePass -
removed
ContainerBuilder::addClassResource(), use theaddObjectResource()or thegetReflectionClass()method instead. -
removed support for top-level anonymous services
-
removed silent behavior for unused attributes and elements
-
removed support for setting and accessing private services in
Container -
removed support for setting pre-defined services in
Container -
removed support for case insensitivity of parameter names
-
removed
AutowireExceptionPassandAutowirePass::getAutowiringExceptions(), useDefinition::addError()and theDefinitionErrorExceptionPassinstead
3.4.0
- moved the
ExtensionCompilerPassto before-optimization passes with priority -1000 - deprecated "public-by-default" definitions and aliases, the new default will be "private" in 4.0
- added
EnvVarProcessorInterfaceand corresponding "container.env_var_processor" tag for processing env vars - added support for ignore-on-uninitialized references
- deprecated service auto-registration while autowiring
- deprecated the ability to check for the initialization of a private service with the
Container::initialized()method - deprecated support for top-level anonymous services in XML
- deprecated case insensitivity of parameter names
- deprecated the
ResolveDefinitionTemplatesPassclass in favor ofResolveChildDefinitionsPass - added
TaggedIteratorArgumentwith YAML (!tagged foo) and XML (<service type="tagged"/>) support - deprecated
AutowireExceptionPassandAutowirePass::getAutowiringExceptions(), useDefinition::addError()and theDefinitionErrorExceptionPassinstead
3.3.0
- deprecated autowiring services based on the types they implement; rename (or alias) your services to their FQCN id to make them autowirable
- added "ServiceSubscriberInterface" - to allow for per-class explicit service-locator definitions
- added "container.service_locator" tag for defining service-locator services
- added anonymous services support in YAML configuration files using the
!servicetag. - added "TypedReference" and "ServiceClosureArgument" for creating service-locator services
- added
ServiceLocator- a PSR-11 container holding a set of services to be lazily loaded - added "instanceof" section for local interface-defined configs
- added prototype services for PSR4-based discovery and registration
- added
ContainerBuilder::getReflectionClass()for retrieving and tracking reflection class info - deprecated
ContainerBuilder::getClassResource(), useContainerBuilder::getReflectionClass()orContainerBuilder::addObjectResource()instead - added
ContainerBuilder::fileExists()for checking and tracking file or directory existence - deprecated autowiring-types, use aliases instead
- added support for omitting the factory class name in a service definition if the definition class is set
- deprecated case insensitivity of service identifiers
- added "iterator" argument type for lazy iteration over a set of values and services
- added file-wide configurable defaults for service attributes "public", "tags", "autowire" and "autoconfigure"
- made the "class" attribute optional, using the "id" as fallback
- using the
PhpDumperwith an uncompiledContainerBuilderis deprecated and will not be supported anymore in 4.0 - deprecated the
DefinitionDecoratorclass in favor ofChildDefinition - allow config files to be loaded using a glob pattern
- [BC BREAK] the
NullDumperclass is now final
3.2.0
- allowed to prioritize compiler passes by introducing a third argument to
PassConfig::addPass(), toCompiler::addPassand toContainerBuilder::addCompilerPass() - added support for PHP constants in YAML configuration files
- deprecated the ability to set or unset a private service with the
Container::set()method - deprecated the ability to check for the existence of a private service with the
Container::has()method - deprecated the ability to request a private service with the
Container::get()method - deprecated support for generating a dumped
Containerwithout populating the method map
3.0.0
- removed all deprecated codes from 2.x versions
2.8.0
- deprecated the abstract ContainerAware class in favor of ContainerAwareTrait
- deprecated IntrospectableContainerInterface, to be merged with ContainerInterface in 3.0
- allowed specifying a directory to recursively load all configuration files it contains
- deprecated the concept of scopes
- added
Definition::setShared()andDefinition::isShared() - added ResettableContainerInterface to be able to reset the container to release memory on shutdown
- added a way to define the priority of service decoration
- added support for service autowiring
2.7.0
- deprecated synchronized services
2.6.0
- added new factory syntax and deprecated the old one
2.5.0
- added DecoratorServicePass and a way to override a service definition (Definition::setDecoratedService())
- deprecated SimpleXMLElement class.
2.4.0
- added support for expressions in service definitions
- added ContainerAwareTrait to add default container aware behavior to a class
2.2.0
- added Extension::isConfigEnabled() to ease working with enableable configurations
- added an Extension base class with sensible defaults to be used in conjunction with the Config component.
- added PrependExtensionInterface (to be able to allow extensions to prepend application configuration settings for any Bundle)
2.1.0
- added IntrospectableContainerInterface (to be able to check if a service has been initialized or not)
- added ConfigurationExtensionInterface
- added Definition::clearTag()
- component exceptions that inherit base SPL classes are now used exclusively (this includes dumped containers)
- [BC BREAK] fixed unescaping of class arguments, method ParameterBag::unescapeValue() was made public