In this episode, we get everything set up to start working with queues in our Laravel app! First things first, we install Redis since it's the recommended queue driver, especially when using Laravel Horizon. If you don’t have Redis yet, make sure to check out how to install it based on your system.
Next, we pull in the Laravel Horizon package through Composer. Horizon gives us a really nice dashboard and makes managing queue workers super easy. Once installed, you just have to start it up with a simple command, and you'll be able to view all your jobs and processes in the dashboard right in your browser.
We also talk through why we're changing our queue connection to Redis, and get Horizon running. You'll see the dashboard, how it displays jobs per minute and lets you dig into completed and failed jobs.
Then, we switch gears and cover job batching. Rather than pushing each chunk as a separate job, batching lets us run a group of jobs and then take additional steps once the whole batch is finished. To support this, we add the necessary batches table with a database migration – making it easy to track batches and see their progress.
By the end, everything's properly set up: Horizon is running, batching is ready, and our system is prepped for handling CSV imports in batches. Next time, we’ll dive into creating those jobs and pushing them onto the queue!