Download the PHP package fahriar/laravel-shared-queue without Composer
On this page you can find all versions of the php package fahriar/laravel-shared-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fahriar/laravel-shared-queue
More information about fahriar/laravel-shared-queue
Files in fahriar/laravel-shared-queue
Package laravel-shared-queue
Short Description A robust, shared-hosting-friendly async queue system for Laravel applications.
License MIT
Informations about the package laravel-shared-queue
Laravel Shared Queue
A robust, shared-hosting-friendly asynchronous task runner for Laravel.
This package provides a database-backed, cron-driven, retryable, idempotent async task system. It is specifically architected for environments where traditional queue workers (like Supervisor + php artisan queue:work or Redis/Horizon) cannot run continuously. Perfect for cPanel, DirectAdmin, or strictly restricted shared hosting setups.
๐ When to use this package
- You are on a shared host with strict background process limits and no daemonizing tools like Supervisor.
- You only have Cron access.
- You want a lightweight database-first queue with absolutely zero extra infrastructure or Redis required.
โ ๏ธ When NOT to use this package
- You need true sub-second real-time processing (use Redis/Beanstalkd instead).
- You have heavy, long-running CPU-bound tasks like video encoding or FFmpeg.
- You are already using Laravel Horizon successfully.
๐ฆ Installation
Require the package via composer:
Publish the configuration file and database migrations:
Run the database migrations to create the shared_queue_tasks table:
๐ ๏ธ Setup & Configuration
Define your tasks inside config/shared-queue.php. Here you map simple string types to concrete classes:
Create a Task Handler
Your handlers must implement the LaravelSharedQueue\Contracts\TaskHandler contract. It natively supports Laravel's Container, so dependency injection in the constructor works perfectly:
Keep your task handlers idempotent and bite-sized. Let the database act as the state engine!
โก Dispatching Tasks
You can dispatch tasks seamlessly using the injected Facade or the global helper function.
Basic Dispatch
Delayed Tasks
Need to process something in the future? Pass an explicit delay:
Idempotency (Prevent Duplicate Jobs)
If you operate in high-traffic or looping scripts, protect against identical tasks firing simultaneously:
If a pending or processing task already exists with this key, the dispatch safely ignores the request to avoid duplicates.
Dispatch After Database Commit
Only dispatch the task if the outer database transaction officially commits:
This safely waits until the active DB transaction commits before finally inserting the task queue row.
โ๏ธ Running the Worker
Since this is built explicitly for shared hosting systems, you run the queue worker natively via Laravel's scheduled cron job engine.
In your routes/console.php (Laravel 11+) or app/Console/Kernel.php (Laravel 10):
Make sure your server/cPanel cron is set to trigger your application schedule every minute natively:
Once running, the worker runs batch checks and operates securely utilizing robust database row-locking tools (skipLocked() / lockForUpdate()) to ensure no race conditions overlap.
๐งฐ Managing Tasks (CLI)
The package provides a suite of helpful Artisan commands to inspect your queue:
๐งช Testing (For Contributors)
To run the internal unit and feature test suite ensuring 100% stable compatibility:
๐ Security Vulnerabilities
If you discover a security vulnerability within this package, please e-mail Fahriar Ahammed via [email protected]. All security vulnerabilities will be promptly addressed.
๐ License
The Laravel Shared Queue package is open-sourced software licensed under the MIT license.
All versions of laravel-shared-queue with dependencies
illuminate/support Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/database Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/console Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/contracts Version ^10.0 || ^11.0 || ^12.0 || ^13.0