Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Queueable Action

Laravel Queueable Action Laravel Package

spatie/laravel-queueable-action

Add simple queue support to Laravel “actions.” Call actions synchronously or dispatch them to the queue with $action->onQueue()->execute(), optionally choosing a queue name. Includes a configurable job class for customization.

View on GitHub
Deep Wiki
Context7

Queueable actions in Laravel

Frequently asked questions about Laravel Queueable Action
How do I convert an existing Spatie Action to a queueable action?
Simply call `onQueue()` on your action instance before executing it. For example, `$action->onQueue()->execute()` will dispatch the action to the default queue. No additional code changes are needed if you’re already using Spatie’s `laravel-action` package.
Can I specify a custom queue name for a queueable action?
Yes, pass a queue name as a string to `onQueue()`, like `$action->onQueue('high-priority')->execute()`. This lets you route actions to specific queues (e.g., `emails`, `reports`) for better workload management.
Does this package work with Laravel 10/11, or only newer versions?
The package is officially compatible with Laravel 10.x and 11.x. Ensure your project uses PHP 8.1+ and verify compatibility by checking the [GitHub releases](https://github.com/spatie/laravel-queueable-action/releases).
How do I handle failures or retries for queueable actions?
Failed jobs will use Laravel’s built-in retry logic (configurable in `config/queue.php`). For custom retries, extend the default `ActionJob` class or implement a dead-letter queue using Laravel’s `failed_jobs` table or a third-party solution like `spatie/laravel-activitylog`.
Will queueable actions slow down my application during high traffic?
Queueable actions offload work to Laravel’s queue system, so synchronous requests return immediately. However, ensure your queue worker processes jobs efficiently. Redis or SQS are recommended for high-throughput scenarios due to their performance.
Can I test queueable actions in unit tests without hitting a real queue?
Yes, mock the queue system using Laravel’s `Queue::fake()` or `Queue::shouldReceive()`. For integration tests, use `Queue::assertPushed()` to verify jobs are dispatched correctly. Avoid testing async behavior in unit tests unless absolutely necessary.
What happens if I don’t configure a queue connection in Laravel?
The package will throw an exception if no queue driver is configured in `config/queue.php`. Ensure you’ve set up a driver (e.g., `database`, `redis`, or `sqs`) and run `php artisan queue:work` to process jobs. Stalled queues may require manual intervention.
Is there a performance difference between using this package vs. Laravel’s built-in `ShouldQueue` interface?
No significant performance difference exists—the package abstracts queue logic into actions, reducing boilerplate. However, queueable actions provide a cleaner separation of concerns for business logic, especially in large applications.
How do I monitor queueable action jobs in production?
Use Laravel Horizon for Redis/SQS queues to track job progress, failures, and throughput. For database queues, query the `jobs` table or integrate tools like `spatie/laravel-monitoring`. Log action-specific events using Laravel’s logging or a dedicated package like `spatie/laravel-logging`.
What are the alternatives to spatie/laravel-queueable-action for async actions in Laravel?
Alternatives include manually implementing `ShouldQueue` in actions or using Laravel’s `Bus` facade for dispatching jobs. However, this package provides a more elegant, action-centric approach with less boilerplate. For advanced use cases, consider `spatie/laravel-jobs` or custom job classes.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport