Download the PHP package tourze/async-command-bundle without Composer
On this page you can find all versions of the php package tourze/async-command-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package async-command-bundle
AsyncCommandBundle
中文
A Symfony bundle for executing console commands asynchronously using Symfony Messenger.
Features
- Execute Symfony console commands asynchronously
- Built-in error handling and logging
- Support for command options and arguments
- Seamless integration with Symfony Messenger
Dependencies
- PHP 8.1 or higher
- Symfony 6.4 or higher
- Symfony Messenger component
- Monolog for logging
Installation
Add this bundle to your Symfony project:
Quick Start
1. Enable the bundle
Add the bundle to your config/bundles.php:
2. Configure Messenger
Configure Symfony Messenger to handle the async command messages:
3. Dispatch commands asynchronously
Configuration
The bundle works out of the box with minimal configuration. The command handler will:
- Log command execution start and completion
- Handle exceptions gracefully
- Support command retries through Symfony Messenger's retry mechanism
Advanced Usage
Using the AsyncCommandService
For a more convenient way to dispatch commands, you can use the AsyncCommandService:
Error Handling and Retries
Configure retry behavior in your messenger configuration:
Logging Configuration
The bundle uses Monolog for logging. You can configure the logger channel:
API Reference
RunCommandMessage
The message class used to dispatch command execution:
RunCommandHandler
The message handler that executes commands:
- Decorated with
#[AsMessageHandler]attribute - Accepts optional
LoggerInterfacefor logging - Handles both recoverable and non-recoverable exceptions
Error Handling
The bundle provides robust error handling:
- Recoverable exceptions: Re-thrown to allow Messenger retry mechanism
- Non-recoverable exceptions: Logged as errors but do not cause message failure
- Logging: All command executions are logged with context information
Testing
Run the test suite:
Run PHPStan static analysis:
Contributing
Please see CONTRIBUTING.md for details on how to contribute to this project.
Development Guidelines
- Follow PSR-12 coding standards
- Write unit tests for new features
- Ensure all tests pass
- Update documentation as needed
Changelog
Please see CHANGELOG.md for details on version history and changes.
License
The MIT License (MIT). Please see License File for more information.
All versions of async-command-bundle with dependencies
psr/log Version ^3|^2|^1
symfony/config Version ^7.3
symfony/console Version ^7.3
symfony/dependency-injection Version ^7.3
symfony/framework-bundle Version ^7.3
symfony/http-kernel Version ^7.3
symfony/messenger Version ^7.3
symfony/property-access Version ^7.3
symfony/yaml Version ^7.3
tourze/async-contracts Version 1.0.*
tourze/bundle-dependency Version 1.*
tourze/symfony-dependency-service-loader Version 1.0.*