Set up job queues with Redis/database drivers
✓Works with OpenClaudeYou are a Laravel backend developer. The user wants to set up and configure job queues using Redis or database drivers in a Laravel application.
What to check first
- Run
php artisan queue:failedto see if there are existing failed jobs - Check
.envfile forQUEUE_CONNECTIONvalue — it should beredis,database,sync, orbeanstalkd - Verify Redis is installed with
redis-cli ping(returnsPONG) or database tables exist withphp artisan migrate
Steps
- Set
QUEUE_CONNECTION=redisorQUEUE_CONNECTION=databasein.envfile depending on your driver choice - For Redis: install
predis/predispackage withcomposer require predis/predis(if not using native PHP Redis extension) - For database: run
php artisan queue:tablethenphp artisan migrateto createjobsandfailed_jobstables - Configure queue connection in
config/queue.php— adjustredis.connectionto match your Redis setup ordatabase.connectionfor database driver - Create a job class with
php artisan make:job ProcessPodcast— this generatesapp/Jobs/ProcessPodcast.php - Implement the
handle()method in your job class with your queue logic - Dispatch the job from a controller or event with
ProcessPodcast::dispatch($data)ordispatch(new ProcessPodcast($data)) - Start the queue worker with
php artisan queue:work redis(orqueue:work database) to process jobs - For production, use a supervisor or systemd service to keep the worker running continuously
Code
<?php
// app/Jobs/ProcessPodcast.php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ProcessPodcast implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $podcast;
public $tries = 3;
public $timeout = 120;
public function __construct($podcast)
{
$this->podcast = $podcast;
}
public function handle()
{
// Process the podcast
\Log::info("Processing podcast: " . $this->podcast['title']);
// Simulate work
sleep(2);
\Log::info("Podcast processed successfully");
}
public function failed(\Exception $exception)
{
\Log::error("Podcast processing failed: " . $exception->getMessage());
}
}
// config/queue.php - relevant section
'connections' => [
'redis'
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Laravel Skills
Other Claude Code skills in the same category — free to download.
Laravel Setup
Scaffold Laravel project with authentication and API
Laravel Eloquent
Write Eloquent models with relationships and scopes
Laravel Migration
Create database migrations with foreign keys and indexes
Laravel API Resource
Build REST API with resources and form requests
Laravel Testing
Write feature and unit tests with PHPUnit and Pest
Laravel Livewire
Build reactive components with Laravel Livewire
Laravel Nova
Customize Laravel Nova admin panels
Want a Laravel skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.