skobka / command-pattern
The usefull set of interface to interact with command design pattern
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/skobka/command-pattern
Requires (Dev)
- phpunit/phpunit: ^7.4@dev
This package is not auto-updated.
Last update: 2025-10-19 11:30:52 UTC
README
Here is set of interfaces and helper implementations for Command design pattern.
What's included
- CommandInterface
- ResultInterface
- ParametrizedCommand
- ParametrizedResultedCommand
How to use
Just make your class implements one of available interfaces:
<?php use skobka\CommandPattern\CommandInterface; class MyCoolCommand implements CommandInterface { /** * @inheritdoc */ public function execute() : void { // write your actions here } } class CommandFactory { public static function create(): CommandInterface { return new MyCoolCommand(); } } $command = CommandFactory::create(); $command->execute();
Roadmap
- Undo/Redo commands
- Generic result command
- Typed parameters
- Symfony Dependency Injection examples