cleverage/archive-process-bundle
This package, ArchiveProcessBundle, is a Laravel-compatible Symfony bundle for handling archival and processing workflows. To get started with v2.0, ensure your project meets the updated requirements:
composer require cleverage/archive-process-bundle
config/bundles.php (Symfony) or config/app.php (Laravel via Symfony integration):
return [
// ...
Cleverage\ArchiveProcessBundle\ClevageArchiveProcessBundle::class => ['all' => true],
];
archive_processor) to define and trigger workflows. Example:
use Cleverage\ArchiveProcessBundle\Processor\ArchiveProcessorInterface;
public function __construct(private ArchiveProcessorInterface $processor) {}
public function archiveItem($item) {
$this->processor->process($item);
}
Workflow Definition:
Define archival processes in YAML/XML or via annotations. Example (config/archive_processes.yml):
my_workflow:
steps:
- { service: 'my_service', method: 'process' }
- { service: 'logger', method: 'log' }
Register the workflow in the bundle’s configuration.
Integration with Laravel:
AppServiceProvider:
public function register() {
$this->app->register(ClevageArchiveProcessBundle::class);
}
$processor = app(ClevageArchiveProcessBundle::class)->getProcessor();
Event-Driven Processing:
Trigger workflows via events (Symfony) or Laravel’s Event facade:
event(new ArchiveItemEvent($item));
validate, transform, archive).ArchiveProcessorInterface in unit tests to isolate logic.Service Registration:
bind() or extend() may be needed for legacy services.$this->app->bind(MyCustomService::class, function ($app) {
return new MyCustomService($app->make(OtherDependency::class));
});
Configuration Overrides:
archive_processes.yml) may not auto-load in Laravel. Manually load them in bootstrap/app.php:
$app->make(Kernel::class)->loadConfigFrom(__DIR__.'/../config/archive_processes.yml');
Performance:
Stopwatch or Laravel’s Benchmark to profile performance.Custom Processors:
Implement ArchiveProcessorInterface to create domain-specific processors. Example:
class CustomProcessor implements ArchiveProcessorInterface {
public function process($item) {
// Custom logic
}
}
Register it as a service:
services:
Cleverage\ArchiveProcessBundle\Processor\ArchiveProcessorInterface: '@custom_processor'
Event Listeners:
Extend workflow behavior by listening to bundle events (e.g., archive.process.start). Example in Laravel:
Event::listen(ArchiveProcessEvents::PROCESS_START, function ($event) {
Log::info('Workflow started for item: '.$event->getItemId());
});
Database Backend:
The bundle supports storing workflow states in a database. Configure doctrine or database options in config/packages/cleverage_archive_process.yaml for persistence.
How can I help you explore Laravel packages today?