Symfony Contracts is a collection of PHP interfaces and abstractions extracted from Symfony components that enable loose coupling and interoperability across packages.
The project addresses the need for standardized contracts that allow different implementations to work together seamlessly. Rather than coupling code directly to concrete implementations, developers can depend on the interfaces provided here. This approach lets packages declare which contracts they implement through Composer's "provide" mechanism, allowing consumers to swap implementations without changing their code. The contracts are organized by domain into separate namespaces and include PHP interfaces, traits, normative docblocks, and reference test suites where applicable.
Adoption makes sense if you are building libraries or applications that need to work with multiple implementations of the same functionality, or if you want to avoid tight coupling to specific Symfony components. The contracts are particularly useful with autowiring and service tagging in dependency injection containers. Unlike PHP-FIG's PSRs, which have broader standardization goals, these contracts are designed specifically to be compatible with Symfony implementations while remaining useful on their own. The project builds on top of PSRs where applicable but focuses on abstractions proven through actual use in Symfony components rather than theoretical standardization.
The project maintains a strict requirement that all contracts must have proven implementations before inclusion, ensuring practical utility. Development activity shows consistent engagement with issues and pull requests routed through the main Symfony repository rather than handled separately. The codebase emphasizes backward compatibility with existing Symfony components, meaning changes respect the stability guarantees that downstream packages depend on.