adachsoft / action
Framework-independent action validation, authorization, execution, and run-history components for PHP applications.
Requires
- php: ^8.3
- adachsoft/action-contracts: ^0.1
- adachsoft/reference-contracts: ^0.1
- psr/clock: ^1.0
Requires (Dev)
- adachsoft/php-code-style: ^0.7.3
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^13.4
- rector/rector: ^2.8
- symplify/phpstan-rules: ^14.19
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
adachsoft/action provides framework-independent components for validating, authorizing, resolving, and executing actions defined with adachsoft/action-contracts. It also persists each execution outcome through an application-provided run repository.
Features
- Validate action parameters against their schema and type-specific rules.
- Compose action type providers, validators, parameter option providers, and handlers.
- Execute actions with authorization and clock-based run timestamps.
- Wire the default components with
ActionFactory, without requiring a dependency injection container.
Requirements
- PHP 8.3 or later
- Composer
Installation
Install the library with Composer:
composer require adachsoft/action
Usage
Provide implementations of the authorization policy, run repository, and clock interfaces, along with your action type providers and handlers. Pass them to ActionFactory and call create() to obtain an ActionExecutorInterface. The library does not prescribe a framework, persistence layer, authorization model, or handler implementation.
See the examples for parameter validation and execution walkthroughs.
Validation behavior
The parameter validator reports missing required values, unknown keys, invalid value types, values outside declared options, and non-list values for multiple parameters. It does not apply defaults. JSON parameters must be encodable with JSON_THROW_ON_ERROR.