script-development / laravel-retention
Retention kernel for Laravel territories: a prune for append-only, hash-chained audit tables that keeps the remaining chain verifiable.
Package info
github.com/script-development/laravel-retention
pkg:composer/script-development/laravel-retention
Requires
- php: ^8.5
- illuminate/container: ^13.40
- illuminate/contracts: ^13.40
- illuminate/database: ^13.40
- illuminate/support: ^13.40
- nesbot/carbon: ^3.0
Requires (Dev)
- infection/infection: ^0.34.0
- larastan/larastan: ^3.9
- laravel/pint: ^1.18
- orchestra/testbench: ^11.0
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Retention and erasure kernel for Script Development and Back to code Laravel territories.
- Audit retention (released in 0.1.0): a prune for append-only, hash-chained audit tables that keeps the remaining chain verifiable. Extracted from entreezuil (EZ-0037, WR-2926).
- Erasure on a retention clock (not here yet): anonymisation in place, with coverage gates that refuse a table or column the erasure route does not place. To be extracted from lokalekeuze.
Status: 0.1.0, released 2026-11-20. Every behaviour here came from a production territory, with one exception ruled by the Commander on 2026-11-20: the prune refuses at a chain row with no creation time, where entreezuil's schema made such a row impossible.
Audit retention
The package owns the algorithm; the territory keeps its recipes.
| Package | Territory |
|---|---|
PruneAuditChains: prefix-only, chunked, verify-before-delete, anchor move and prune record in one transaction, three attempts |
implements Audit\Contracts\HashChains: its chains, recompute(), its writer's chain lock, where a prune is recorded |
ChainStartResolver: where a chain starts (anchor or seed), with the anchor's MAC checked and reported |
its writer and verifier read the chain start through it |
AuditChainAnchor (table audit_chain_anchors) and AnchorMac |
its artisan command, schedule and config |
Config read: audit.hash_seed and audit.retention_months (at least 1).
Adopting
composer require script-development/laravel-retention.- Set
audit.hash_seed(the seed your writer starts a chain from) andaudit.retention_months(at least 1) in your config. The package ships no defaults: without both, the container cannot buildPruneAuditChains. - A territory without
audit_chain_anchors:php artisan vendor:publish --tag=retention-audit-migrations, then migrate. A territory that already has the table does not publish it; the package never loads the migration itself, so that territory is untouched. - Bind your implementation:
$this->app->bind(HashChains::class, YourChains::class);. Every chain's model andaudit_chain_anchorsmust be on the prune's own (default) connection; the prune refuses to run otherwise. - Point your writer's empty-table path and your verifier's walk at
ChainStartResolver, so all three agree where a chain starts. - Call
PruneAuditChains::execute()from a scheduled command; exit with the result'sexitCode().
License
MIT