Plugin System
The plugin system implements the Port & Adapter pattern, providing extensible framework capabilities through interfaces (Ports) and implementations (Adapters).
In This Section
- Command Bus - Dispatch commands to handlers
- Query Bus - Dispatch queries to handlers
- Event Bus - Publish and subscribe to domain events
- Dispatcher - PSR-14 event dispatching and listener registration
- Transaction - Database transaction management
- SQL Driver - Database connection abstraction
- Logger - Logging abstraction
- Session - Session management
- Authorization - RBAC permission checking
- Cache - PSR-16 compliant key-value caching with TTL support
- Password Hasher - Secure password hashing
- ID Generator - Unique identifier generation
- Clock - Testable time operations
Plugin Structure
Each plugin in src/Plugin/ contains:
Port/- Interfaces defining the contractAdapter/- One or more implementationsInternal/(optional) - Plugin-internal utilities
Available Plugins
| Plugin | Port | Adapters |
|---|---|---|
| CommandBus | CommandBusInterface | SyncCommandBus, TransactionalCommandBus |
| QueryBus | QueryBusInterface | SyncQueryBus |
| EventBus | EventBusInterface | SyncEventBus |
| Dispatcher | DispatcherInterface (PSR-14), ListenerRegistryInterface (PSR-14) | LeagueDispatcher, LeagueListenerRegistry |
| Logger | LoggerInterface | FileLogger, NullLogger |
| Session | SessionInterface | OdanSession |
| Authorization | AuthorizationInterface | RbacAuthorizationService |
| Cache | CacheInterface (PSR-16) | InMemoryCache, RedisCache, FileCache, NullCache |
| Transaction | TransactionInterface | InMemoryTransaction, SqliteTransaction, MysqlTransaction, PostgresqlTransaction |
| SqlDriver | SqlDriverInterface | InMemoryDriver, SqliteDriver, MysqlDriver, PostgresqlDriver |
| IdGenerator | IdGeneratorInterface | UuidV4Generator, UuidV7Generator, UlidGenerator, TimestampIdGenerator |
| Clock | ClockInterface | SystemClock, MonotonicClock, FrozenClock, OffsetClock |
| PasswordHasher | PasswordHasherInterface | BcryptPasswordHasher, PlaintextPasswordHasher |
Usage Pattern
Depend on Ports (interfaces), never on Adapters directly:
Configure adapter selection in config/{app}/container.php: