Concurrency - Laravel 12.x - The PHP Framework For Web Artisans https://laravel.com/docs/12.
x/concurrency
M�n�ge your servers with freedom �nd control. Le�rn more �bout the new Forge →
v12.x
1 of 6 10/17/2025, 10:17 AM
Concurrency - Laravel 12.x - The PHP Framework For Web Artisans https://laravel.com/docs/12.x/concurrency
Concurrency
# Introduction
Sometimes you m�y need to execute sever�l slow t�sks which do not depend on one
�nother. In m�ny c�ses, signi�c�nt perform�nce improvements c�n be re�lized by
executing the t�sks concurrently. L�r�vel's f�c�de provides � simple,
convenient API for executing closures concurrently.
L�r�vel �chieves concurrency by seri�lizing the given closures �nd disp�tching them
to � hidden Artis�n CLI comm�nd, which unseri�lizes the closures �nd invokes it
within its own PHP process. After the closure h�s been invoked, the resulting v�lue is
seri�lized b�ck to the p�rent process.
The f�c�de supports three drivers: (the def�ult), , �nd
.
The driver offers improved perform�nce comp�red to the def�ult
driver, but it m�y only be used within PHP's CLI context, �s PHP does not support
forking during web requests. Before using the driver, you need to inst�ll the
p�ck�ge:
The driver is prim�rily useful during testing when you w�nt to dis�ble �ll
concurrency �nd simply execute the given closures in sequence within the p�rent
process.
2 of 6 10/17/2025, 10:17 AM
Concurrency - Laravel 12.x - The PHP Framework For Web Artisans https://laravel.com/docs/12.x/concurrency
# �unning Concurrent T�sks
To run concurrent t�sks, you m�y invoke the f�c�de's method. The
method �ccepts �n �rr�y of closures which should be executed simult�neously
in child PHP processes:
To use � speci�c driver, you m�y use the method:
Or, to ch�nge the def�ult concurrency driver, you should publish the
con�gur�tion �le vi� the Artis�n comm�nd �nd upd�te the
option within the �le:
# Deferring Concurrent T�sks
If you would like to execute �n �rr�y of closures concurrently, but �re not interested
in the results returned by those closures, you should consider using the
method. When the method is invoked, the given closures �re not executed
immedi�tely. Inste�d, L�r�vel will execute the closures concurrently �fter the HTTP
3 of 6 10/17/2025, 10:17 AM
Concurrency - Laravel 12.x - The PHP Framework For Web Artisans https://laravel.com/docs/12.x/concurrency
immedi�tely. Inste�d, L�r�vel will execute the closures concurrently �fter the HTTP
response h�s been sent to the user:
L�r�vel is the most productive w�y to
build, deploy, �nd monitor softw�re.
© 2025 L�r�vel Leg�l St�tus
4 of 6 10/17/2025, 10:17 AM
Concurrency - Laravel 12.x - The PHP Framework For Web Artisans https://laravel.com/docs/12.x/concurrency
Document�tion Cloud
St�rter Kits Forge
�ele�se Notes Nightw�tch
Blog V�por
News Nov�
Community
L�r�belles
Le�rn
Jobs
C�reers
Trust
C�shier 64 �obots
Dusk Kirschb�um
Horizon Active Logic
Oct�ne Tighten
Scout byte5
Penn�nt Jump24
5 of 6 10/17/2025, 10:17 AM
Concurrency - Laravel 12.x - The PHP Framework For Web Artisans https://laravel.com/docs/12.x/concurrency
Pint Curotec
S�il DevSqu�d
S�nctum Vehikl
Soci�lite �edberry
Telescope More P�rtners
Pulse
�everb
Echo
6 of 6 10/17/2025, 10:17 AM