romanfedorskij / seed
Framework-agnostic toolkit for versioned, fingerprinted data seeds
Requires
- php: >=8.3.0
- ext-json: *
- psr/container: ^1.1 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.1
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpyh/coding-standard: ^2.6.3
- rector/rector: ^2.7
- symfony/console: ^6.4 || ^7.0
- testo/testo: ^0.10.55
Suggests
- ext-pdo: Required by the optional PostgreSQL execution store
- ext-pdo_pgsql: Required by the optional PostgreSQL execution store
- symfony/console: Required to use the optional seed:* commands
Provides
None
Conflicts
None
Replaces
None
README
A framework-agnostic PHP 8.3+ toolkit for versioned data seeds. It provides attributed seed classes, deterministic dependency planning, composable SHA-256 fingerprints, execution metadata stores, a conservative default runner, PSR-11 composition, and optional Symfony Console commands.
The application still owns the useful work: parsing files, writing domain data, choosing transactions, and configuring infrastructure.
Requirements and installation
The core requires PHP 8.3+, ext-json, and psr/container. Symfony Console and PDO PostgreSQL support are optional. After the repository is registered on Packagist, install the first release with:
composer require romanfedorskij/seed:^0.1
Quick start
Run the maintained example:
composer example
Expected output:
executed country_reference@2026-11-v1 rows=2
The example defines an attributed AbstractSeed, injects an application repository, builds a registry, and executes it through DefaultSeedRunner with JsonExecutionStore. See examples/quick-start.php.
Safety model
id + version is the logical release key; its fingerprint is immutable. An identical successful release is skipped, while the same key with changed code or declared inputs is reported as drift. The default runner preflights the complete graph, runs sequentially, fails fast, requires explicit retry/recovery, and reconciles durable pending work without creating another attempt.
#[SeedSource] fingerprints and audits a file; it never loads or parses it. Declare delegated implementation classes and stable configuration with #[FingerprintClass] and #[FingerprintValue].
Documentation
- Getting started
- Runtime and fingerprint reference
- JSON and PostgreSQL stores
- Console commands
- Generic PSR-11 integration
- Symfony DI integration
- Migration from the pre-release API
- Changelog
Development
Run composer check for metadata validation, security audit, executable documentation, Testo, PHPStan, Rector, and PHP-CS-Fixer. composer test:coverage generates var/coverage.xml and enforces the current coverage ratchet. PostgreSQL contract tests run when SEED_TEST_PG_DSN is set.
MIT. See LICENSE.