Laravel's queue feature is extensively used in various projects, both big and small. However, setting up queues often involves complex steps like using Redis for job management and Supervisor for monitoring queue processes, which may not always be convenient.
Let's consider an alternative to traditional queue management with Laravel Horizon for larger projects. While Laravel Horizon offers a comprehensive view of queues and workers, it still relies on Supervisor for continuous operation. But what about scenarios where minimal events occur, like a simple blog?
Table of contents:
An efficient way to handle queue workers is by running them as cronjobs. This method, utilized on this site for tasks such as form submissions, eliminates the need to wait for background processes to complete.
By setting a maximum runtime for each worker and allowing it to stop once the job is done, you can streamline the queue process. Moreover, storing jobs at a database level simplifies the setup without the complexities of using Redis.
Laravel provides convenient CLI commands to create database tables for organizing queued jobs. Execute the following commands to generate the required migrations:
php artisan queue:table
php artisan queue:failed-table
Inform Laravel that you are using the database for queue processing by setting the QUEUE_CONNECTION
variable to database
in your environment settings.
QUEUE_CONNECTION=database
For production environments, configure the cron schedule to run the queue worker effectively. Adjust the path based on your project setup and PHP binaries. A sample command could be:
* * * * * /usr/bin/php [PATH]/artisan queue:work --max-time=60 > /dev/null
Define the path by navigating to your Laravel project directory and running pwd
to determine the absolute path. This cron schedule ensures continuous queue processing every minute.
While this cron-based approach suits projects with moderate job volumes, it may not be ideal for handling extensive queues. Additionally, ensure your PHP configuration allows executions exceeding sixty seconds for seamless operation. Verify this by checking the max execution time using /usr/bin/php --info | grep max_execution_time
. If the response is unlimited (0) or above sixty, you're all set!
Do you own a company or need help with your Laravel project? I can help you with that. Check the plans and let me know if you have any questions.
Get 1 month free with yearly plan during checkout.
$ 3 ,995
/m
What's included:
$ 5 ,995
/m
What's included:
Ok, just book a call now.
Good question! For starters, the annual cost of a full-time senior-level developer now exceeds $100,000, plus benefits (and good luck finding one available).
Aside from that, you may not always have enough work to keep them busy at all times, so you're stuck paying for time you aren't able to utilize.
With the monthly plan, you can pause and resume your subscription as often as you need to ensure you're only paying your developer when you have work available for them.
No, once subscribed you're able to request as many things as you'd like, and they will be delivered one by one.
Delivery will always be fast without compromising quality. Very complex requests will be divided into smaller products for continuous delivery.
Always, before starting to work, we can make a planning so that you know, before starting, when each change will be delivered.
You'll work directly with me, the founder and only person behind DeveloperJoy.
We understand you may not have enough work to fill up entire month. Perhaps you only have one or two requests at the moment. That's where pausing your subscription comes in handy.
Billing cycles are based on 31 day period. Let's say you sign up and use the service for 21 days, and then decide to pause your subscription. This means that the billing cycle will be paused and you'll have 10 days of service remaining to be used anytime in the future
I had experience making products with PHP, Go, and JavaScript/TypeScript.
Also I feel really comfortable working with WordPress, Laravel, Symfony, Vue.js, React, Svelte, and more.
Mail me and we will see how best to collaborate.
You can make this request by email, sharing a task board with me or, depending on your plan, by call or Slack.
That's fine. You can pause your subscription when finished and return when you have additional requests needs. There's no need to let the remainder of your subscription go to waste.
Due to the high quality nature of the work, there will be no refunds issued.