austral / contracts
Austral shared contracts: interfaces, value objects and enums used across the Austral bundles
Requires
- php: >=8.4 <9.0
- doctrine/collections: ^2.2
- symfony/http-foundation: ^7.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- phpstan/phpstan: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^10.5 || ^11
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-19 17:41:19 UTC
README
Shared abstractions of the Austral bundles: interfaces, small value objects and enums.
This is layer 0 of Austral V4. Every Austral bundle may depend on it; it depends on no Austral bundle. When a bundle needs something from another bundle that is not below it, it goes through a contract defined here, never through the concrete classes of the other bundle.
Installation
composer require austral/contracts
Requires PHP 8.4 or higher. It is not a Symfony bundle: there is nothing to register in config/bundles.php.
Content
| Namespace | Contract | Implemented by |
|---|---|---|
Austral\Contracts\Entity |
EntityInterface |
entity-bundle (Entity) |
Austral\Contracts\Translate |
TranslateMasterInterface, TranslateChildInterface |
entity-translate-bundle |
Austral\Contracts\File |
FileInterface |
entity-file-bundle |
Austral\Contracts\Domain |
FilterByDomainInterface |
http-bundle |
Austral\Contracts\Link |
LinkResolverInterface, ResolvedLink |
seo-bundle |
Austral\Contracts\Enum |
PublicationStatus |
— |
Internal links
use Austral\Contracts\Link\LinkResolverInterface; final class LinkRenderer { public function __construct(private ?LinkResolverInterface $linkResolver = null) {} public function url(string $entityClass, string $id): ?string { // Without seo-bundle there is no resolver: internal links are not resolved. return $this->linkResolver?->resolve($entityClass, $id)?->url; } }
Rules
What can go in this package:
- interfaces, enums, value objects and events shared by several bundles;
- no service, no configuration, no Symfony bundle class;
- no reference to an Austral bundle nor to
App\(checked bytests/ContractsTest.php); - dependencies limited to
doctrine/collectionsandsymfony/http-foundation.
A contract used by a single bundle, or only by bundles that already depend on its owner, stays in that bundle.
Development
composer install
composer test
composer stan
License
MIT, see LICENSE.
Credits
Created by Matthieu Beurel. Sponsored by Yipikai Studio.