A PHP component that matches incoming HTTP request URLs to route configurations and generates URLs from named routes.
symfony/dependency-injection
A PHP component for standardizing and centralizing how objects are constructed and wired together in an application.
- Stars
- 4,166
- Forks
- 92
- Open issues
- 0
- Last commit
- 12 hours ago
What is it?
The DependencyInjection component is a PHP library from the Symfony project. It provides a central container that defines how objects are constructed and which dependencies they receive, so that object creation is handled in one place rather than scattered through application code.
Because construction logic is centralized, classes can declare what they need instead of creating their own dependencies. This makes code easier to test, swap implementations in, and reconfigure without editing the classes that use them. The package is MIT licensed and is published as a standalone Symfony component that can be used outside the full framework.
The README is brief and points to the official Symfony documentation for usage details and contribution guidelines. Issues and pull requests are handled in the main Symfony repository rather than this package.
Key features
- 01Centralizes object construction and dependency wiring in one container.
- 02Lets classes declare dependencies instead of instantiating them directly.
- 03Distributed as a standalone PHP package usable outside the full Symfony framework.
- 04Released under the MIT license.
Use cases
- Structuring a PHP application so services are created and configured in one place.
- Making PHP classes easier to unit test by injecting their dependencies.
- Using Symfony's container in a PHP project that does not run the full framework.
Topics
FAQ
- What is dependency-injection?
- A PHP component for standardizing and centralizing how objects are constructed and wired together in an application. The DependencyInjection component is a PHP library from the Symfony project. It provides a central container that defines how objects are constructed and which dependencies they receive, so that object creation is handled in one place rather than scattered through application code.
- Is dependency-injection free to use? What license does it have?
- dependency-injection is open source under the MIT license. Check the license terms before using it in commercial products.
- Is dependency-injection still maintained?
- Actively maintained. The last commit to dependency-injection was on Nov 6, 2026.
- What can I use dependency-injection for?
- Structuring a PHP application so services are created and configured in one place. Making PHP classes easier to unit test by injecting their dependencies. Using Symfony's container in a PHP project that does not run the full framework.
- Where can I get dependency-injection?
- The source code and installation instructions are on GitHub: https://github.com/symfony/dependency-injection
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A PHP component for running external commands in sub-processes, with control over input, output and timeouts.
A PHP component that provides a better dump() function for inspecting arbitrary variables, as a replacement for var_dump().
A PHP component of basic filesystem utilities for creating, copying, moving, and removing files and directories.
A Swift and SwiftUI dependency injection container that registers factories as simple computed properties, with scopes, contexts, and test mocking.
A pure-PHP fallback that provides a partial implementation of the Mbstring extension for environments where it is not installed.