lemric / batch-processing
Batch Processing
v1.0.2
2026-04-27 10:57 UTC
Requires
- php: >=8.4
- psr/cache: ^3.0
- psr/container: ^2.0
- psr/event-dispatcher: ^1.0
- psr/log: ^3.0
- psr/simple-cache: ^3.0
Requires (Dev)
- doctrine/dbal: ^4.0
- doctrine/migrations: ^3.0
- doctrine/orm: ^3.0
- friendsofphp/php-cs-fixer: ^3.95
- illuminate/console: ^11.0 || ^12.0
- illuminate/contracts: ^11.0 || ^12.0
- illuminate/queue: ^11.0 || ^12.0
- illuminate/support: ^11.0 || ^12.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.1
- roave/security-advisories: dev-latest
- symfony/config: ^6.4 || ^7.0
- symfony/console: ^6.4 || ^7.0
- symfony/dependency-injection: ^6.4 || ^7.0
- symfony/expression-language: ^7.0
- symfony/http-kernel: ^6.4 || ^7.0
- symfony/lock: ^7.0
- symfony/mailer: ^7.0
- symfony/messenger: ^6.4 || ^7.0
- symfony/mime: ^7.0
- symfony/serializer: ^7.0
- symfony/validator: ^7.0
- symfony/yaml: ^6.4 || ^7.0
Suggests
- ext-pcntl: Enables atomic, signal-safe spawn/cleanup in SystemCommandTasklet and graceful SIGTERM/SIGINT handling in JobLauncher.
- ext-pdo: Required for PdoJobRepository, PdoItemReader, PdoItemWriter and PdoTransactionManager.
- ext-redis: For RedisItemReader/RedisItemWriter (alternative to predis/predis).
- doctrine/orm: For DoctrineRepositoryItemReader/Writer.
- laravel/framework: For Laravel Bridge integration.
- predis/predis: For RedisItemReader/RedisItemWriter.
- symfony/event-dispatcher: Provides a fully-featured PSR-14 event dispatcher.
- symfony/expression-language: For SpEL-like late-binding expressions in step/job scope.
- symfony/lock: For single-instance job enforcement via LockingJobLauncher.
- symfony/messenger: For asynchronous job execution via Symfony Messenger.
- symfony/serializer: For Symfony Serializer-based JSON item reader/writer adapters.
- symfony/stopwatch: For Stopwatch integration in Symfony Profiler (timeline per Job/Step/Chunk).
- symfony/validator: For BeanValidatingItemProcessor backed by Symfony Validator.
This package is auto-updated.
Last update: 2026-04-27 10:58:44 UTC
README
Enterprise-grade batch processing for PHP 8.4+.
Lemric BatchProcessing is a framework-agnostic library for building robust, restartable, observable batch jobs in PHP. Compliance with PSR standards and the idiomatic PHP style.
Why Lemric BatchProcessing?
- Production-ready — atomic per-chunk transactions, full restart semantics, durable metadata.
- Framework-agnostic — works standalone, with optional bridges for Symfony 6.4/7+ and Laravel 11+/12+.
- Standards-first — PSR-3 logger, PSR-6/16 cache, PSR-11 container, PSR-14 events.
- Modern PHP — readonly classes, enums, attributes, typed properties, strict types.
Installation
composer require lemric/batch-processing
Requires PHP 8.4 or higher.
Quick Example
use Lemric\BatchProcessing\BatchProcessing; use Lemric\BatchProcessing\Domain\JobParameters; use Lemric\BatchProcessing\Item\Reader\IteratorItemReader; use Lemric\BatchProcessing\Testing\InMemoryItemWriter; $env = BatchProcessing::inMemoryEnvironment(); $reader = new IteratorItemReader(range(1, 1000)); $writer = new InMemoryItemWriter(); $step = $env->stepBuilderFactory->get('demoStep') ->chunk(100, $reader, null, $writer) ->build(); $job = $env->jobBuilderFactory->get('demoJob')->start($step)->build(); $execution = $env->launcher->run($job, JobParameters::of(['run.id' => 1])); echo $execution->getStatus()->value; // COMPLETED
Documentation
Full documentation lives in the docs/ directory:
- Getting Started — installation, quick start, architecture.
- Core Concepts — domain model, jobs, steps, chunks.
- Reading & Writing — readers, processors, writers.
- Error Handling — retry, skip, exceptions.
- Infrastructure — repository, transactions, events.
- Advanced — partitioning, flow jobs, scopes, restart.
- Framework Integration — Symfony & Laravel.
- Reference — configuration, PSR, testing, performance.
Development
Clone the repository and install dependencies:
git clone https://github.com/Lemric/BatchProcessing.git
cd BatchProcessing
composer install
Run the test suite:
composer test
Run static analysis and code style fixes:
composer stan
Support
- Issues: GitHub Issues
- Security: Security Policy
- Discussions: GitHub Discussions
License
This project is developed by Lemric and is available under a dual licensing model:
| Use case | Allowed | Cost |
|---|---|---|
| Open Source project | ✅ | Free |
| Personal non-commercial use | ✅ | Free |
| Commercial / SaaS / enterprise | ❌ | Paid license required |
| Closed-source project | ❌ | Paid license required |
For commercial licensing inquiries, contact: dominik@labudzinski.com
See the LICENSE file for full terms.
Authors
- Dominik Labudzinski — dominik@labudzinski.com — labudzinski.com
- Lemric — lemric.com