Download the PHP package waffle-commons/contracts without Composer
On this page you can find all versions of the php package waffle-commons/contracts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download waffle-commons/contracts
More information about waffle-commons/contracts
Files in waffle-commons/contracts
Package contracts
Short Description The central contract package for Waffle Commons. Every other waffle-commons/* component depends only on this package and its declared PSR interfaces β the perimeter that keeps components independently replaceable.
License MIT
Informations about the package contracts
Waffle Contracts Component
Release:
0.1.0-beta6|CHANGELOG.md
The Waffle Framework's central contract package. Every other waffle-commons/* component depends only on this package and on its declared PSR interfaces. No component may depend on a sibling's concrete implementation β contracts is the line that keeps the ecosystem decoupled.
This package contains interfaces, attributes, enums, exception interfaces, typed constants, and the small set of concrete routing exceptions (RouteNotFoundException, MethodNotAllowedException) shared across components. No business logic ever ships from here.
π Beta-2 highlights β HTTP method correctness
- NEW β
Waffle\Commons\Contracts\Routing\Exception\MethodNotAllowedException(concretefinalclass) and itsMethodNotAllowedExceptionInterfacemarker. Carries the allowed-methods list so downstream renderers can emit the RFC 7231Allowheader on405responses. - NEW β
Waffle\Commons\Contracts\Routing\Constant: HTTP-method string constants (METHOD_GET,METHOD_POST,METHOD_PUT,METHOD_PATCH,METHOD_DELETE,METHOD_HEAD,METHOD_OPTIONS). - CHANGED β
Waffle\Commons\Contracts\Routing\Attribute\Route(relocated fromwaffle-commons/routingin Beta-2): gained thearray $methods = ['GET']parameter for method filtering and route overloading. Constructor argument order normalised so$pathprecedes$methods. Emptymethodsarray means "any method". - NEW β
Waffle\Commons\Contracts\Exception\WaffleExceptionInterface: explicit base interface for the framework's exception hierarchy.
Beta-1 inheritance
The Beta-1 line introduced the security and HTTP-correctness foundations this package still carries:
- BREAKING (Beta-1) β
CsrfTokenManagerInterface::issue(),validate(),refresh()take a$sessionIdargument. The HMAC binds tokens to the per-browserWAFFLE_SIDcookie issued byAnonymousSessionMiddleware. - NEW (Beta-1) β
Waffle\Commons\Contracts\Security\Attribute\PublicAccessβ explicit opt-out for the fail-closed ABAC default. Without#[Voter]and without#[PublicAccess],SecureContainer::analyze()denies with HTTP403. - NEW (Beta-1) β
Waffle\Commons\Contracts\Routing\Exception\RouteNotFoundExceptionβ concretefinalclass implementingRouteNotFoundExceptionInterface. Thrown byCoreRoutingMiddlewareso missing routes render as404instead of500. - NEW (Beta-1) β CSRF binding constants on
Waffle\Commons\Contracts\Security\Csrf\Constant:SESSION_COOKIE_NAME(WAFFLE_SID),SESSION_ID_BYTES(32),SESSION_REQUEST_ATTRIBUTE(_anon_sid),SESSION_COOKIE_MAX_AGE(2_592_000), plusMIN_SECRET_BYTES(32) andSECRET_ENV_KEY(WAFFLE_CSRF_SECRET).
π¦ Installation
π§± What's inside
| Namespace | Purpose |
|---|---|
Waffle\Commons\Contracts\Attribute |
Marker attributes (#[Dto]) consumed by the framework's argument resolver. |
Waffle\Commons\Contracts\Cache |
PSR-6 + PSR-16 extension interfaces (CacheInterface, CacheItemPoolInterface, StampedeProtectionInterface). |
Waffle\Commons\Contracts\Config |
ConfigInterface typed getters (getInt, getString, getArray, getBool). |
Waffle\Commons\Contracts\Console |
ConsoleApplicationInterface, CommandInterface, InputInterface, OutputInterface. |
Waffle\Commons\Contracts\Constant\Constant |
Ecosystem-wide typed constants (env names, security levels, attribute keys). |
Waffle\Commons\Contracts\Container |
ContainerInterface extending PSR-11 + ResettableInterface for worker-mode resets. |
Waffle\Commons\Contracts\Controller |
BaseControllerInterface. |
Waffle\Commons\Contracts\Core |
KernelInterface β the heart of the request lifecycle. |
Waffle\Commons\Contracts\Enum |
Framework-wide enums (e.g. Failsafe). |
Waffle\Commons\Contracts\ErrorHandler |
ErrorRendererInterface for content-negotiated error rendering. |
Waffle\Commons\Contracts\EventDispatcher |
EventDispatcherInterface, ListenerProviderInterface (PSR-14 extension). |
Waffle\Commons\Contracts\Exception |
Root exception interfaces (ValidationExceptionInterface, etc.). |
Waffle\Commons\Contracts\Handler |
ArgumentResolverInterface, ResponseConverterInterface. |
Waffle\Commons\Contracts\Http |
Framework-specific HTTP factories on top of PSR-7/17 (GlobalsFactoryInterface, ResponseEmitterInterface, ServerRequestFactoryInterface). |
Waffle\Commons\Contracts\Parser |
YamlParserInterface. |
Waffle\Commons\Contracts\Pipeline |
MiddlewareStackInterface (PSR-15 stack). |
Waffle\Commons\Contracts\Routing |
RouterInterface + routing exception interfaces. |
Waffle\Commons\Contracts\Runtime |
RuntimeInterface for FrankenPHP / classic SAPI bootstrap. |
Waffle\Commons\Contracts\Security |
SecurityInterface, SecurityRuleInterface, VoterInterface + #[Voter] / #[Rule] attributes + CSRF attributes. |
Waffle\Commons\Contracts\Service |
ResettableInterface β implemented by any service that needs reset between FrankenPHP worker requests. |
Waffle\Commons\Contracts\System |
SystemInterface. |
Waffle\Commons\Contracts\Validation |
ValidatorInterface, ValidationResultInterface, ViolationInterface. |
π PHP 8.5 surface
The contracts package is the canonical reference for the framework's PHP 8.5 contract style:
- Typed constants everywhere β
public const string EVENT_NAME = '...';,public const int SECURITY_LEVEL10 = 10;. - Marker attributes with
Attribute::TARGET_*declarations (#[Dto],#[Voter],#[Rule]). final readonly classfor value-object attributes.- All return types and parameter types are explicit; no
mixedin the public surface except where PSR-11 mandates it (ContainerInterface::get(): mixed).
π Sample interfaces
KernelInterface β the heart of the framework:
ConfigInterface β typed config access:
#[Dto] β marker attribute for auto-hydrated DTOs:
A DTO consumer in your controller:
π€ Decoupling rule
Every concrete waffle-commons component must depend on waffle-commons/contracts and on nothing else from the waffle-commons/* namespace, unless explicitly declared in its own composer.json require. This rule is enforced at build time by mago guard perimeters in every component.
π§ Architectural boundary (mago guard)
contracts is the root of the ecosystem, so its own perimeter (enforced by vendor/bin/mago guard, bundled into composer mago, zero baselines β see mago.toml [guard.perimeter]) is the strictest of all: production code under Waffle\Commons\Contracts may depend only on:
Waffle\Commons\Contracts\**β itselfPsr\**β PSR interfaces@global+Psl\**β PHP core and the PHP Standard Library
It depends on *no other `waffle-commons/package** β that is what lets every other component depend on it without creating a cycle. Test code underWaffleTests\Commons\Contractsis unrestricted (@all`).
Structural rules are guarded too: interfaces must be named *Interface, Exception\** classes must end in *Exception, and any Enum\** namespace may hold only enum declarations (see the Decoupling rule above for the ecosystem-wide counterpart).
π§ͺ Testing
π Documentation
Full guides live in the central DiΓ‘taxis documentation tree:
π License
MIT β see LICENSE.md.
All versions of contracts with dependencies
psr/container Version ^2.0
psr/http-client Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/http-server-handler Version ^1.0
psr/event-dispatcher Version ^1.0
psr/log Version ^3.0
psr/cache Version ^3.0
psr/http-server-middleware Version ^1.0
psr/simple-cache Version ^3.0