Download the PHP package echo-fusion/contracts without Composer
On this page you can find all versions of the php package echo-fusion/contracts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download echo-fusion/contracts
More information about echo-fusion/contracts
Files in echo-fusion/contracts
Package contracts
Short Description Core interfaces and contracts for the EchoFusion framework, providing shared, standardized interfaces for cross-package interoperability and modular design.
License MIT
Homepage https://github.com/echo-fusion/contracts
Informations about the package contracts
Contracts
Welcome to the EchoFusion Contracts repository! This package defines the core interfaces and abstractions that are shared across the EchoFusion framework, ensuring consistency and flexibility in how components interact with each other.
Part of EchoFusion, a modular PHP framework built from small packages.
Installation
Requirements
- PHP 8.1, 8.2 or 8.3
What is inside
Every interface lives in the namespace EchoFusion\Contracts\<Package>. A package depends on this one instead of on another concrete package, so any implementation can be swapped for another.
| Namespace | Interfaces | Implemented by |
|---|---|---|
AuthManager |
AuthManagerInterface, GuardInterface, StatefulGuardInterface, UserInterface, UserProviderInterface, PasswordHasherInterface |
authmanager |
ConfigManager |
ConfigInterface |
configmanager |
DatabaseManager |
ConnectionInterface, DatabaseManagerInterface |
databasemanager |
EventManager |
EventInterface (a PSR-14 stoppable event), EventManagerInterface (a PSR-14 dispatcher and listener provider) |
eventmanager |
MiddlewareManager |
MiddlewareManagerInterface, MiddlewarePipelineInterface |
middlewaremanager |
ModuleManager |
ModuleInterface, ModuleManagerInterface |
modulemanager |
PluginManager |
PluginInterface (receives the container), PluginManagerInterface |
pluginmanager |
RouteManager |
RouterInterface (find a route), RouteRegistrarInterface (register routes), RouteInterface (immutable definition), RouteMatchInterface, RouteMatcherInterface, RouteLoaderInterface |
routemanager |
ServiceManager |
ServiceManagerInterface, SettableContainerInterface |
servicemanager |
ServiceProvider |
ServiceProviderInterface |
any package that registers services |
SessionManager |
SessionInterface |
sessionmanager |
TemplateManager |
TemplateEngineInterface, TemplateManagerInterface |
templatemanager |
Usage
Implement an interface in your own code, or type-hint it so any implementation can be passed in. For example, a service provider:
Upgrading from 1.x to 2.0
| Change | What to do |
|---|---|
RouterInterface no longer has get(), post() ... options() |
They moved to RouteRegistrarInterface. Type-hint it where you register routes; the Router of routemanager implements both. |
RouteInterface has no setters |
Routes are values: create them complete (new Route($name, $method, $path, $action, ...)). |
EventManagerInterface is a PSR-14 dispatcher |
Call dispatch($event); trigger() is gone from the interface. detach() is part of it. EventInterface extends PSR-14's StoppableEventInterface. |
PluginInterface::register() receives a container |
register(SettableContainerInterface $container). |
Every other interface is unchanged, so packages that do not use the ones above only need their echo-fusion/contracts constraint widened to ^1.x || ^2.0.
Versioning
Contracts follow semantic versioning. A new interface or class is a minor release. Adding a method to an existing interface is a breaking change and needs a new major version.
Testing
Credits
License
The MIT License (MIT). Please see LICENSE for more information.
All versions of contracts with dependencies
psr/http-message Version ^2.0
psr/http-server-middleware Version ^1.0
psr/container Version ^2.0
psr/event-dispatcher Version ^1.0