Download the PHP package b7s/laravel-queue-flow without Composer
On this page you can find all versions of the php package b7s/laravel-queue-flow. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-queue-flow
Laravel Queue Flow
A Laravel Queue wrapper system, simplifying queue management without creating separate Job classes.
Features
- ๐ Simple API: No need to create separate Job classes
- ๐ Type-safe: Full PHP 8.2+ type hints
- ๐ฏ Fluent Interface: Chain methods for easy configuration
- ๐ Encryption Support: Built-in job encryption
- ๐ Unique Jobs: Prevent duplicate job execution
- โก Rate Limiting: Control job execution rate
- ๐จ Flexible: Support for delays, connections, and queues
- ๐งช Tests: Pest tests included
Requirements
- PHP 8.2 or higher
- Laravel 11.0 or higher
Installation
Install the package via Composer:
The service provider will be automatically registered.
Publish Configuration (Optional)
This package has some configurations, but it doesn't override the default Laravel settings, which you can modify in config/queue.php.
Usage
Basic Usage
Using global helper function qflow:
Auto-dispatch on Destruction
The queue will automatically dispatch when the object is destroyed if a callback was added:
Know more about the
dispatch()return value here.
Using the Queue instance directly:
Delayed Jobs
Dependency Injection
Resolve the queue via Laravel's container and keep your classes clean:
You can pass an array of closures to add() to add multiple jobs:
Helper Function
Use the global qflow() helper to configure jobs inline.
Jobs dispatch automatically by default
You can change this behavior changing the config
auto_dispatch_on_queue_flow_helperor by setting the .env variableQUEUE_FLOW_AUTO_DISPATCH_ON_HELPERtofalse:
Disable auto-dispatch when you need more control (set the second parameter - autoDispatch - to false):
Without Relations
Prevent Eloquent model relations from being serialized:
Unique Jobs
Ensure a job is only queued once:
Unique Until Processing
Job is unique only until it starts processing:
Encrypted Jobs
Encrypt the job payload:
Failure Handling
Execute a callback when a job fails:
The failure callback receives the exception that caused the job to fail, allowing you to:
- Log detailed error information
- Send notifications to administrators
- Update database records
- Trigger compensating actions
Rate Limiting
Apply rate limiting to jobs:
Configure rate limiters in config/queue-flow.php:
Custom Queue and Connection
Chaining Multiple Options
The methods follow the same pattern and the same naming convention as Laravel (see Laravel Documentation).
Configuration
The configuration file allows you to set defaults:
auto_dispatchโ controls whether the fluentQueueinstance should dispatch automatically when destructed (default:false).auto_dispatch_on_queue_flow_helperโ controls the default behavior for theqflow()helper whenautoDispatchis not passed explicitly (default:true).dispatch_return_of_multiple_jobs_as_collectionโ controls whether the dispatch method should return a collection of PendingDispatch objects when multiple jobs are dispatched (default:true).
How It Works
QueueFlow Queue abstracts Laravel's queue system by:
- Wrapping closures in specialized Job classes
- Applying configurations through a fluent interface
- Dispatching jobs using Laravel's native queue system
- Managing state through service classes
Testing
Running Tests
The package includes a comprehensive test suite covering all features. For detailed documentation, see TESTING.md.
Test Coverage
To generate a test coverage report (requires Xdebug or PCOV):
Key Test Scenarios
-
Basic Queue Operations
- Job dispatching
- Queue configuration
- Error handling
-
Helper Function
-
Database Integration
- Transaction handling
- CRUD operations
- Rollback on failure
- Edge Cases
- Large payloads
- Error conditions
- Concurrency issues
License
This package is open-sourced software licensed under the MIT license.
Credits
- Built on top of Laravel's robust queue system
All versions of laravel-queue-flow with dependencies
illuminate/support Version ^11.0|^12.0
illuminate/queue Version ^11.0|^12.0
illuminate/contracts Version ^11.0|^12.0
laravel/serializable-closure Version ^1.3|^2.0