If you are using php artisan serve then you are not missing anything. It is not built for concurrency.
Concurrent Requests in Artisan
I have a long-running operation in my laravel app which needs to run synchronously for the user. However, I'd like to provide a progress bar while it's running.
For this, I need to be able to poll the server in javascript to get the status (which will be posted by the long process).
This is fine in production as the server can handle concurrent requests. However, in development on Artisan this isn't the case - the polling requests have to wait until the task finishes.
Before I look at setting up a full local server for this, can I check if I'm missing any startup commands for artisan which will allow it to handle concurrent requests?
You can fork multiple workers by setting the PHP_CLI_SERVER_WORKERS environment variable; this gives you concurrency:
PHP_CLI_SERVER_WORKERS=4 php artisan serve
This is how you can do it; my personal preference (even in development) is an actual web server such as Apache or Nginx
Please or to participate in this conversation.