Skip to content
CAI
Software that uses CAICheck a score

symfony/contracts

58.0

Adequate · 17 November 2026

1.7k

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 HttpClient contracts for HTTP client abstractions

This release introduces the Symfony HttpClient contracts, providing a set of interfaces that define the semantics for HTTP client implementations. The \HttpClientInterface\ defines the core methods for making requests (\request\), streaming responses (\stream\), and creating client variants with default options (\withOptions\), along with a comprehensive set of request options including authentication, headers, body handling, timeouts, and TLS settings. The \ResponseInterface\ specifies how to access status codes, headers, content, and transport info, while also supporting cancellation and JSON decoding via \toArray\. Additionally, the \ChunkInterface\ and \ResponseStreamInterface\ enable chunked response processing, allowing users to handle large responses or real-time data streams efficiently.

HttpClient · high confidence

Introduce HttpClient exception contracts

The HttpClient component now exposes a set of standard exception interfaces in the \Symfony\\Contracts\\HttpClient\\Exception\ namespace, allowing users to catch specific error types such as \ClientExceptionInterface\ (4xx), \ServerExceptionInterface\ (5xx), \RedirectionExceptionInterface\ (3xx), \TimeoutExceptionInterface\, \DecodingExceptionInterface\, and \TransportExceptionInterface\. These interfaces provide a consistent hierarchy for error handling, with \HttpExceptionInterface\ exposing a \getResponse()\ method to access the underlying response object.

HttpClient/Exception · high confidence

Introduction of Symfony Translation Contracts

This release introduces the Symfony Translation Contracts, a set of PHP interfaces and traits extracted from the Symfony components to provide stable abstractions for translation logic. The package defines the TranslatorInterface for message translation (including pluralization support via the %count% parameter), the LocaleAwareInterface for managing the current locale, and the TranslatableInterface for objects that can translate themselves. It also includes the TranslatorTrait, which provides a concrete implementation of these interfaces, allowing developers to build translation services that are decoupled from specific Symfony component versions.

Translation · high confidence

New EventDispatcher contract interfaces and base event class

The EventDispatcher contracts package now includes the \EventDispatcherInterface\ (extending PSR-11/PSR-20 standards), the \ListenerIntrospectionInterface\ for inspecting registered listeners and priorities, and a base \Event\ class implementing \StoppableEventInterface\. These abstractions allow developers to decouple their code from specific Symfony component implementations while maintaining compatibility with the broader PSR event system.

EventDispatcher · high confidence

Behavioural changes

Cache contracts now expose save failures and support tag-based invalidation

The Cache contracts have been updated to provide better visibility into cache operations and support for tag-based invalidation. The \CacheInterface::get()\ method now accepts a \$metadata\ argument that reports whether the computed value was successfully saved (via \ItemInterface::METADATA\_SAVE\_FAILED\), allowing applications to handle save errors gracefully. Additionally, the \TagAwareCacheInterface\ introduces \invalidateTags()\ for bulk invalidation of cached items by tag, and the \ItemInterface\ now supports tagging items via \tag()\ and retrieving metadata such as expiry time and creation time. A new \CallbackInterface\ allows callbacks to decide whether a computed value should be saved, and \NamespacedPoolInterface\ enables namespace-based key prefixing for scoped invalidation.

Cache · high confidence

Introduce generic trigger\_deprecation() function

The Deprecation contract now provides a global \trigger\_deprecation()\ function, replacing the previous use of \assert()\ for triggering deprecation notices. This function accepts the package name, version, and a message (with optional printf-style arguments) to generate silenced \E\_USER\_DEPRECATED\ errors, allowing developers to catch and log deprecations via custom error handlers or ignore them by defining an empty function.

Deprecation · high confidence

New PHP 8 attributes for service dependency injection

The Service contracts now include \#\[Required\] and \#\[SubscribedService\] attributes to replace legacy traits and interfaces for declaring dependencies. The \#\[Required\] attribute marks properties or methods as mandatory dependencies and supports a priority argument to control execution order when multiple methods are involved. The \#\[SubscribedService\] attribute allows developers to define subscribed services directly on methods or properties, specifying the service key, type, nullability, and additional DI attributes, facilitating a more modern, attribute-based approach to service subscription.

Service/Attribute · high confidence

Service contracts introduce new interfaces and traits for service location and subscription

The Service contracts package now includes \ContainerProviderInterface\ (with a deprecated \ContainerAwareInterface\ alias) to expose service containers, \ServiceProviderInterface\ to declare provided service types, and \ServiceCollectionInterface\ for countable/iterable service providers. The \ServiceLocatorTrait\ has been rewritten to use constructor property promotion and improved type reflection for \getProvidedServices()\. The old \ServiceSubscriberTrait\ is deprecated in favor of \ServiceMethodsSubscriberTrait\, which extends service subscription to support PHP 8.4 property hooks and stricter type checking. \ResetInterface\ now explicitly returns void.

Service · high confidence

Symfony Contracts 3.8: New interfaces, options, and test infrastructure updates

This release introduces several new capabilities and configuration options across the contract packages. For caching, \ItemInterface::METADATA\_SAVE\_FAILED\ allows reporting failed saves through the \$metadata\ argument of \CacheInterface::get()\, and \NamespacedPoolInterface\ supports namespace-based invalidation. HTTP client contracts now expose trailers via \ResponseInterface\ and support the \max\_connect\_duration\ option, while also allowing a custom minimum TLS version via the \crypto\_method\ option. Dependency injection contracts add a \$priority\ argument to the \\#\[Required\]\ attribute, introduce \ServiceCollectionInterface\, and rename \ServiceSubscriberTrait\ to \ServiceMethodsSubscriberTrait\ (with support for hooked properties). Additionally, \ContainerProviderInterface\ is added, and \TranslatorInterface::getLocale()\ is available. The test suite has been updated to be compatible with PHPUnit 10+ and 11+, with configuration changes in \phpunit.xml.dist\ including deprecation triggering and extension bootstrapping.

(repo-wide) · high confidence

Test coverage

Added HTTP test fixture server for HttpClient tests; Added test cases for ServiceLocator behavior; Added tests for CacheTrait behavior; Added tests for ServiceMethodsSubscriberTrait and legacy ServiceSubscriberTrait; Added translator test suite for pluralization and locale handling; New HttpClient test suite and test utilities.

Dependencies

Symfony Contracts v3.8: PHP 8.1 requirement and PSR-3/1.1/1.0 updates

The symfony/contracts package has been updated to version 3.8, raising the minimum PHP requirement to 8.1. This release aligns with modern standards by requiring psr/cache ^3.0, psr/container ^1.1\|^2.0, and psr/event-dispatcher ^1.0, while introducing a conflict rule for incompatible ext-psr versions. The package now replaces several sub-packages (cache-contracts, deprecation-contracts, event-dispatcher-contracts, http-client-contracts, service-contracts, and translation-contracts) and includes the deprecation function file in its autoload configuration.

(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 57.3 → 58.0 (+0.7)
  • Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.

Lenses

  • Code Health 65.3 → 60.9 (-4.4)
  • Architecture 100.0 → 100.0 (0.0)
  • Maturity 52.3 → 57.9 (+5.6)
  • Readiness 46.5 → 46.3 (-0.2)
  • Security 100.0 → 100.0 (0.0)

Resolved (1)

  • Off-boarding risk: anonymized user #1

New (5)

  • Documentation: no build, run or usage example (Cache/README.md)
  • Documentation: no build, run or usage example (EventDispatcher/README.md)
  • Documentation: no build, run or usage example (HttpClient/README.md)
  • Documentation: no build, run or usage example (Service/README.md)
  • Documentation: no build, run or usage example (Translation/README.md)

Changes since last survey

  • 7 commits — 7 feature/other, 0 fixes

By area

  • (repo) — 6 commits
  • HttpClient/Test — 1 commit

Notable commits

  • change: Merge branch '5.4' into 6.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 '8.1' into 8.2
  • change: Merge branch '8.1' into 8.2
  • change: [HttpClient] Let the test suite run on another port so that several runs can work in parallel

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/contracts 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 b07f3b704dc81010d0e3f4675648b63ebb948d58 — 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.