Skip to content
CAI
Software that uses CAICheck a score

symfony/dependency-injection

49.2

Weak · 17 November 2026

24.1k

lines of production code

PHP

primary language

5

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Introduce Preloader utility and modernize Dumper base classes

The Dumper component now includes a new Preloader class to manage PHP preloading, allowing users to exclude specific classes or namespaces and append preloading instructions to a file. Additionally, the abstract Dumper class and DumperInterface have been modernized: the constructor now uses constructor property promotion for the container, and the dump() method signature has been updated to explicitly return a string or array, improving type safety and code clarity.

Dumper · high confidence

Introduces PHP-DSL configurators for service container configuration

The Loader/Configurator directory now provides a new PHP-based fluent API for defining services, parameters, and environment variables, replacing the need for XML or YAML in many cases. This includes the ContainerConfigurator for top-level setup, ServicesConfigurator for defining service definitions, aliases, and prototypes, and specialized configurators like ServiceConfigurator, InlineServiceConfigurator, and ReferenceConfigurator for granular control. The new system supports advanced features such as service stacking via StackConfigurator, environment variable processing with EnvConfigurator, and type-safe configuration shapes via AppReference. Users can now write configuration in PHP with full IDE support and type checking, leveraging methods like \service()\, \param()\, and \env()\ to build the container definition programmatically.

Loader/Configurator · high confidence

New Dependency Injection attribute classes for service configuration

This change introduces a comprehensive set of new PHP attributes in the \Symfony\\Component\\DependencyInjection\\Attribute\ namespace to configure services directly in code. These include \\#\[AsAlias\]\ for service aliases, \\#\[AsDecorator\]\ and \\#\[AsTagDecorator\]\ for service decoration with ordering constraints (\within\/\around\), and \\#\[AsTaggedItem\]\ for defining index/priority in tagged iterators. Configuration rules are now declarable via \\#\[Autoconfigure\]\, \\#\[AutoconfigureTag\]\, and \\#\[AutoconfigureResourceTag\]\. Service wiring is enhanced with \\#\[Autowire\]\ (supporting \env\/\param\/\lazy\), \\#\[AutowireCallable\]\, \\#\[AutowireClassMap\]\, \\#\[AutowireDecorated\]\, \\#\[AutowireInline\]\, \\#\[AutowireIterator\]\, \\#\[AutowireLocator\]\, \\#\[AutowireMethodOf\]\, and \\#\[AutowireServiceClosure\]\. Environment-specific registration is handled by \\#\[When\]\ and \\#\[WhenNot\]\, while \\#\[Target\]\ hints named autowiring aliases, \\#\[Lazy\]\ enables lazy loading, and \\#\[Exclude\]\ prevents service registration.

Attribute · high confidence

New Kernel and Bundle infrastructure for DI-powered applications

This change introduces a new \Symfony\\Component\\DependencyInjection\\Kernel\ namespace containing the foundational classes for building applications driven by the Dependency Injection component, independent of the full HTTP stack. It adds \AbstractKernel\ and \KernelTrait\ to provide the core application lifecycle (boot, shutdown, container initialization) and directory management, alongside \AbstractBundle\ and \BundleInterface\ to standardize how bundles register extensions and configuration. The \ServicesBundle\ is added to provide default wiring for core services like the event dispatcher and clock, while \RequiredBundle\ offers an attribute-based mechanism to declare bundle dependencies. Also in this area: 1 commit (0 fixes) modifying Compiler, Kernel; 1 commit (1 fix) fixing Kernel; Remove unconditional garbage collection in kernel shutdown; Add shutdown-only reset mode for kernel services; Container reset on kernel shutdown.

Kernel · low confidence · unverified

PHP-based DI configuration now supports service decoration, callable factories, and tag decoration

The PHP DSL for configuring the dependency injection container gains several new capabilities through new configurator traits. Services can now be decorated using the \decorate()\ method, which supports decorating specific service IDs or all services with a given tag via \decorateTag()\. Factory configuration is expanded with \fromCallable()\, allowing services to be created from callables (including expressions), and the \factory()\ method now accepts \Closure\ and \Expression\ objects directly, while rejecting the legacy \service:method\ string notation. Additionally, the configurator now supports setting abstract, synthetic, and lazy service definitions, configuring bindings, and adding resource tags.

Loader/Configurator/Traits · high confidence

Service container parameters are now accessible via PSR-11 ContainerBag

Users can now access service container parameters as a standard PSR-11 container using the new ContainerBag class. This class implements the ContainerBagInterface, providing read-only access to parameters through standard methods like get(), has(), and all(). The change also introduces support for environment variable placeholders via EnvPlaceholderParameterBag, allowing parameters to reference environment variables using the %env(VAR\_NAME)% syntax. Additionally, parameter bags now support deprecation warnings and non-empty parameter validation, enhancing parameter management and error reporting.

ParameterBag · high confidence

Removals

Removed Resource classes from DependencyInjection

The \FileResource\ class and \ResourceInterface\ have been removed from the \Symfony\\Component\\DependencyInjection\\Resource\ namespace. These files, which previously handled filesystem-based resource tracking and defined the resource contract, are no longer present in this component, indicating a structural change to how resources are managed or a migration to a different component.

Resource · high confidence

Architecture

DependencyInjection Loader component refactored and expanded

The Loader component has undergone a major architectural overhaul: the legacy abstract Loader, DelegatingLoader, and their resolvers have been removed in favor of a modernized FileLoader that extends Symfony Config's FileLoader and utilizes a trait (ContentLoaderTrait) for shared parsing logic. New loaders have been introduced to support recursive directory scanning (DirectoryLoader) and glob patterns (GlobFileLoader), while existing loaders (Xml, Yaml, Php, Ini) have been updated to support environment-specific configuration (via 'when@' keys), PSR-4 auto-discovery with exclusion patterns, and improved error handling for undefined extensions.

Loader · high confidence

Refactored DI compiler with new base pass and enhanced attribute-driven configuration

The DependencyInjection compiler has been restructured to improve maintainability and extendability. A new \AbstractRecursivePass\ base class now handles the common logic for recursively traversing and processing service definitions, arguments, and expressions, reducing code duplication across compiler passes. Additionally, a new \AttributeAutoconfigurationPass\ has been introduced to automatically apply configuration rules based on PHP attributes found on classes, methods, properties, and parameters, allowing for more declarative service configuration. Several existing passes like \AutowirePass\, \AnalyzeServiceReferencesPass\, and \AliasDeprecatedPublicServicesPass\ have been updated to extend this new base class, ensuring consistent behavior and easier future extensions.

Compiler · high confidence

Behavioural changes

Dependency Injection argument classes restructured and modernized

The Symfony DependencyInjection component has reorganized its argument handling by introducing a dedicated Argument namespace with an ArgumentInterface, ArgumentTrait, and specific argument classes (such as AbstractArgument, BoundArgument, EnvClosureArgument, IteratorArgument, LazyClosure, LazyProxyArgument, RewindableGenerator, ServiceClosureArgument, ServiceLocator, ServiceLocatorArgument, TaggedClassMapArgument, and TaggedIteratorArgument). This refactoring standardizes how complex service arguments are represented, serialized, and processed, while also deprecating the use of default index/priority methods in favor of the \#\[AsTaggedItem\] attribute for tagged iterators and locators.

Argument · high confidence

Dependency Injection component introduces new exception classes and lazy message evaluation

The Dependency Injection component now includes a dedicated set of exception classes (such as ServiceNotFoundException, ParameterNotFoundException, and AutowiringFailedException) that implement the component's ExceptionInterface and PSR-11's NotFoundExceptionInterface. These exceptions provide more specific error messages, including suggestions for similar services or parameters, and support lazy evaluation of error messages to improve performance when Xdebug is enabled.

Exception · high confidence

DependencyInjection component major overhaul and cleanup

This release introduces significant changes to the DependencyInjection component, including the deprecation and removal of the XML configuration format, the fluent PHP config format, and the \SimpleXMLElement\ helper class. It adds new features such as \ServicesResetter\ for resetting non-shared services, \StaticEnvVarLoader\ for static environment variable loading, and \ReverseContainer\ to map service objects back to their IDs. The component also enforces stricter typing, updates the PHPUnit configuration to version 13.1, and refactors core classes like \Container\ and \Alias\ to support modern PHP features and improved deprecation handling.

(repo-wide) · high confidence

Invalidate routing cache when container parameters change

The configuration system now detects changes to container parameters and invalidates the routing cache accordingly. This is achieved by introducing a new \ContainerParametersResource\ that tracks parameter values and a corresponding \ContainerParametersResourceChecker\ that verifies freshness against the current container state, ensuring that cached routes remain consistent when underlying configuration values are modified.

Config · high confidence

Native lazy ghost objects replace ProxyManager for service proxies

The LazyProxy/PhpDumper component now generates native PHP lazy ghost objects by default for lazy services, removing the dependency on the external ProxyManager library. This change introduces a new DumperInterface and a LazyServiceDumper that leverages the VarExporter component to create proxies, allowing services to be loaded on-demand without instantiating their dependencies. Users will see a shift in how proxy classes are generated, with the system automatically detecting whether a ghost object or a traditional proxy is suitable based on the service definition.

LazyProxy/PhpDumper · high confidence

New PHP-based service configuration and deprecation of EventDispatcher alias

The Kernel/Resources/services.php file introduces a new PHP-based service container configuration, registering core services such as the event dispatcher, filesystem, and clock. This change deprecates the autowiring alias for EventDispatcherInterface in favor of the ContractsEventDispatcherInterface, and adds support for resetting non-shared services via the ServicesResetter. Additionally, it preloads the EnvNotFoundException class to improve performance during environment variable resolution.

Kernel/Resources · high confidence

New lazy proxy instantiator architecture with ghost object support

The LazyProxy component now introduces a dedicated Instantiator interface and two implementations: LazyServiceInstantiator, which automatically uses PHP 8.4's native lazy ghost objects when possible (falling back to virtual proxies otherwise), and RealServiceInstantiator, which bypasses proxying entirely to return the real service instance directly. This change provides a cleaner, more performant foundation for lazy-loading services by leveraging native language features where available, while still supporting older proxy mechanisms for non-ghostable services.

LazyProxy/Instantiator · high confidence

Removal of XML service configuration schema

The XML schema file for service definitions (services-1.0.xsd) has been removed from the project. This change eliminates support for validating and parsing service configurations defined in XML format, meaning users must now rely on other configuration formats such as YAML or PHP arrays for defining services and parameters.

Loader/schema/dic · high confidence

Simplified container extension configuration via new configurator-based API

The Extension component introduces a new, simplified way to define container extensions. A new \AbstractExtension\ base class and \ConfigurableExtensionInterface\ allow extensions to use \ContainerConfigurator\ objects for loading and prepending configuration, replacing the previous imperative approach. The \Extension\ class now provides a default \getAlias()\ implementation and a \processConfiguration()\ helper, while the \ExtensionInterface\ has been streamlined to remove XML namespace and XSD path methods, reflecting the deprecation of XML configuration support. This change shifts the extension model towards a more declarative, configuration-object-oriented style.

Extension · high confidence

Test coverage

Added Graphviz test fixtures for service container visualization; Added PHP container dump fixtures for DependencyInjection tests; Added compiler pass tests for the DependencyInjection component; Added container fixture files for DependencyInjection tests; Added test coverage for DependencyInjection dumpers and preloader; Added test coverage for new DependencyInjection attribute classes; Added test fixture for late-aliased interface in instanceof autoconfiguration; Added test fixture for missing parent class in PSR-4 discovery; Added test fixture for the Exclude attribute; Added test fixtures for DependencyInjection autowiring and type resolution; Added test fixtures for HotPath DI container scenarios; Added test fixtures for INI configuration parsing; Added test fixtures for PSR-4-discovered abstract types with \#\[Autoconfigure\]; Added test fixtures for Preload type handling; Added test fixtures for Prototype DI attributes; Added test fixtures for extension configuration validation scenarios; Added test fixtures for prototype service discovery in nested directories; Added test fixtures for prototype tagged priority behavior; Added test fixtures for recursive directory loading; Added test fixtures for singly-implemented interface detection; Added test fixtures for static constructor prototype services; Added test fixtures for the \#\[AsAlias\] attribute; Added test fixtures for the PHP DependencyInjection DSL; Added test fixtures for the RegisterCallableServicesPass; Added tests for ContainerParametersResource and ContainerParametersResourceChecker; Added tests for DependencyInjection Loader Configurator components; Added tests for DependencyInjection exception classes; Added tests for LazyServiceInstantiator and RealServiceInstantiator; Added tests for the LazyServiceDumper and NullDumper components; Added tests for the new DI extension configuration API; Added tests for the new HTTP-less DependencyInjection Kernel infrastructure; Added unit tests for DependencyInjection loaders; Added unit tests for ParameterBag components; Added unit tests for dependency injection argument classes; Added unit tests for the DependencyInjection component; Expanded test fixtures for DependencyInjection attributes and services.

Dependencies

Symfony DependencyInjection v8.1 release with PHP 8.4 requirement

The Symfony DependencyInjection component has been updated to version 8.1, raising the minimum PHP version requirement to 8.4.1. This release aligns with the broader Symfony 8.0 ecosystem, requiring psr/container ^1.1\|^2.0 and symfony/service-contracts ^3.6, while adding conflicts with older versions of symfony/config and symfony/http-kernel (below 8.2). Development dependencies have also been updated to support Symfony 7.4 and 8.0 components.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 49.5 → 49.2 (-0.3)
  • Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 51.0 → 50.6 (-0.4)
  • Architecture 83.9 → 81.7 (-2.2)
  • Maturity 41.6 → 41.6 (0.0)
  • Readiness 46.2 → 45.6 (-0.6)
  • Security 88.7 → 88.7 (0.0)

Resolved (8)

  • Duplicated block (7 lines × 2) (Dumper/XmlDumper.php)
  • Duplicated block (9 lines × 2) (Loader/IniFileLoader.php)
  • Further sole-owners (lower concentration)
  • Hotspot: Compiler/AnalyzeServiceReferencesPass.php (Compiler/AnalyzeServiceReferencesPass.php)
  • Hotspot: Compiler/ResolveInstanceofConditionalsPass.php (Compiler/ResolveInstanceofConditionalsPass.php)
  • Hotspot: Compiler/ValidateEnvPlaceholdersPass.php (Compiler/ValidateEnvPlaceholdersPass.php)
  • Off-boarding risk: anonymized user #1
  • Projects may be oversized for their cohesion

New (27)

  • Circular dependency (Container.php)
  • Edited copies of one member (4 members, 12+ corresponding lines) (Alias.php)
  • Edited copies of one member (4 members, 8+ corresponding lines) (Compiler/CheckDefinitionValidityPass.php)
  • Edited copy of a member (10 corresponding lines) (ContainerBuilder.php)
  • Edited copy of a member (10 corresponding lines) (Kernel/KernelTrait.php)
  • Edited copy of a member (11 corresponding lines) (Definition.php)
  • Edited copy of a member (13 corresponding lines) (Alias.php)
  • Edited copy of a member (14 corresponding lines) (Dumper/PhpDumper.php)
  • Edited copy of a member (14 corresponding lines) (ParameterBag/ParameterBag.php)
  • Edited copy of a member (15 corresponding lines) (ContainerBuilder.php)
  • Edited copy of a member (18 corresponding lines) (Dumper/XmlDumper.php)
  • Edited copy of a member (5 corresponding lines) (Compiler/AutowireAsDecoratorPass.php)
  • Edited copy of a member (7 corresponding lines) (Kernel/BundleExtension.php)
  • Edited copy of a member (9 corresponding lines) (Loader/Configurator/DefaultsConfigurator.php)
  • Edited copy of a member (9 corresponding lines) (Loader/Configurator/DefaultsConfigurator.php)
  • Edited copy of a member (9 corresponding lines) (ServicesResetter.php)
  • FileLoader.import (cognitive 22) (Loader/FileLoader.php)
  • FileLoader.import (cyclomatic 16) (Loader/FileLoader.php)
  • Off the main sequence: Exception
  • Off-boarding risk: anonymized user #1
  • …and 7 more

Changes since last survey

  • 21 commits — 17 feature/other, 4 fixes

By area

  • (repo) — 11 commits
  • (root) — 3 commits
  • Kernel/KernelTrait.php — 2 commits
  • Compiler/AttributeAutoconfigurationPass.php — 1 commit
  • Compiler/InlineServiceDefinitionsPass.php — 1 commit
  • Loader/FileLoader.php — 1 commit
  • Loader/YamlFileLoader.php — 1 commit
  • Tests/Compiler — 1 commit

Notable commits

  • fix: [DependencyInjection] Fix attribute configurator phpdoc rejecting narrowed reflectors
  • fix: [DependencyInjection] Fix parent::buildContainer() tracking the default bundles.php of a MicroKernelTrait kernel
  • fix: [DependencyInjection] Fix resolving env placeholders with many env vars
  • fix: [DependencyInjection][HttpKernel] Fix type-hinting file_locator and services_resetter with their deprecated HttpKernel types
  • change: Merge branch '6.4' into 7.4
  • change: Merge branch '6.4' into 7.4
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '7.4' into 8.1
  • change: Merge branch '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • change: [DependencyInjection] Clear the service reference graph built by InlineServiceDefinitionsPass
  • change: [DependencyInjection] Don't keep the container in AttributeAutoconfigurationPass after processing
  • change: [DependencyInjection] Release the container builder before loading the compiled container
  • change: [DependencyInjection][Routing] Track the glob resource of import() so new files are detected
  • change: [DependencyInjection][Routing][Translation] Track loaded files before reading them
  • change: [DependencyInjection][Serializer] Drop assertions that cannot run after the expected exception
  • …and 1 more

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

symfony/dependency-injection was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 155aee0de30cb000de73198b69b9dcca44787fd5 — the exact code this score is about.
  • Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.