As the new laravel comes loaded with composer run dev
command to start all the requirements like vite, queue, pail, and the classic server.
It's great, but for some people who use the sail in their day-to-day development, this command directly won't work. This article will modify this command to work with the laravel sail.
If you are not familiar with the sail and how to get started with laravel sail, you can read it here.
Step One
Update the composer.json -> scripts -> dev
array to add "sail up -d"
This will start the sail services as the sail services has to be up and running for the next steps to work.
Step Two
update the current npx concurrently -c ...
command to the following command.
"npx concurrently -c \"#c4b5fd,#fb7185,#fdba74\" \"sail artisan queue:listen --tries=1\" \"sail artisan pail --timeout=0\" npm:dev --names=queue,logs,vite"
Finally, your dev script will look like below.
"dev": [
"Composer\\Config::disableProcessTimeout",
"sail up -d",
"npx concurrently -c \"#c4b5fd,#fb7185,#fdba74\" \"sail artisan queue:listen --tries=1\" \"sail artisan pail --timeout=0\" npm:dev --names=queue,logs,vite"
]
and you are good to go.
If you have any better ideas or approaches, please let me know in the comments. I will be glad to improve.