adachsoft / automation-json-file
JSON file-backed repositories for automation schedules and runtime state.
Requires
- php: ^8.3
- adachsoft/action-contracts: ^0.1.2
- adachsoft/automation-contracts: ^0.1.2
- adachsoft/recurrence-contracts: ^0.1
- adachsoft/reference-contracts: ^0.1
Requires (Dev)
- adachsoft/php-code-style: ^0.7.3
- adachsoft/recurrence: ^0.1
- 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
Framework-free JSON file-backed repositories for automation schedules, schedule runtime state, and fired-occurrence markers. The package implements the repository contracts from adachsoft/automation-contracts and requires PHP 8.3 or later.
Requirements
- PHP 8.3 or later.
- Composer.
Features
- Persist schedules, runtime state, and fired-occurrence markers in separate JSON documents.
- Use shared and exclusive file locks and atomic file replacement for safe local-file updates.
- Record occurrence markers atomically to prevent the same occurrence from being marked twice.
- Prune old markers according to an application's retention policy.
Installation
composer require adachsoft/automation-json-file
Usage
Create the repositories with writable file paths and provide them to your automation runtime. Schedule mapping also requires a recurrence-rule normalizer; the adachsoft/recurrence package provides one. See the repository setup example.
Use a shared local filesystem for processes accessing the same documents. Each document is updated atomically on its own; operations across multiple documents are not transactional. Fired markers provide at-most-once behavior, not exactly-once execution: a process may stop after recording a marker and before running its actions.