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 Artisan Dispatchable

Laravel Artisan Dispatchable Laravel Package

spatie/laravel-artisan-dispatchable

Register Laravel jobs as Artisan commands by implementing the ArtisanDispatchable interface. Dispatch queued jobs via CLI (e.g., php artisan process-podcast) so long-running tasks won’t block the scheduler, while remaining runnable from Artisan.

View on GitHub
Deep Wiki
Context7

Dispatch Laravel jobs via Artisan

Frequently asked questions about Laravel Artisan Dispatchable
How do I make a Laravel job runnable via Artisan *and* the queue?
Extend your job with `ShouldQueue` and implement the `ArtisanDispatchable` interface. Then run it via `php artisan job-name` or schedule it with `$schedule->job(new YourJob)`. No extra configuration is needed.
Will this work with Laravel 10+? Any breaking changes?
Yes, it’s fully compatible with Laravel 10+. The package follows Laravel’s native job system, so no breaking changes are expected unless Laravel’s queue or Artisan APIs change.
Can I test jobs dispatched via Artisan in PHPUnit?
Yes. Use `Artisan::call('job-name')` in tests to simulate CLI execution. For queue behavior, test with Laravel’s standard queue testing helpers like `Queue::fake()`.
What happens if I dispatch a job via Artisan but it fails? Will it retry?
No. Artisan dispatches bypass the queue system, so retries won’t trigger. Use `ShouldQueue` consistently for retries or wrap Artisan calls in error handling.
Does this package support Redis/SQS queues?
Yes. It relies on Laravel’s built-in queue system, so Redis, SQS, or database drivers work out of the box. No extra setup is required for queue backends.
How do I monitor jobs dispatched via Artisan in Horizon?
Horizon won’t track Artisan-dispatched jobs by default. Use logging (e.g., `Log::info()` in your job) or a custom monitoring solution to track CLI executions separately.
Is there a way to limit concurrency for Artisan-dispatched jobs?
No. Artisan commands run sequentially, so concurrency isn’t controlled by this package. For parallelism, dispatch jobs via the queue instead or use Laravel’s `dispatchSync()` carefully.
Can I use this for one-off CLI tasks that don’t need queuing?
Yes. It’s ideal for hybrid workflows—use Artisan for immediate execution (e.g., `php artisan process-backup`) while still allowing queued scheduling for production.
What’s the performance impact of dispatching jobs via Artisan vs. queue?
Artisan dispatches are synchronous and block the CLI process, while queue jobs run asynchronously. For long tasks (>1 min), prefer queueing to avoid scheduler delays.
Are there alternatives to this package for Artisan + queue jobs?
No direct alternatives exist, but you could manually dispatch jobs via `Artisan::queue()` or use Laravel’s `dispatch()` in commands. This package provides a cleaner, standardized approach.
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