Laravel Async is a package that provides a straightforward way to run code asynchronous and parallel based on the Spatie Async wrapper for the Laravel application. You can install the Laravel Async package by using Composer: composer require vxm/laravel-async

You can publish the config file (optional) with: php artisan vendor:publish --provider="VXM\Async\AsyncServiceProvider" --tag="config" After installation, now you can try running async code via the Async facade: use Async; for ($i = 1; $i function ($output) { // `$output` of job in this case is `123`.

}, ]); // Another way: Async::run('AsyncJobClass@handleMethod', [ 'success' => 'AsyncJobEventListener@handleSuccess', 'timeout' => 'AsyncJobEventListener@handleTimeout', 'error' => 'AsyncJobEventListener@handleError' ]); Async::batchRun(['AsyncJobClassA@handleMethod', ['success' => 'AsyncJobEventListenerA@handleSuccess']], ['AsyncJobClassB@handleMethod', ['success' => 'AsyncJobEventListenerB@handleSuccess']], ['AsyncJobClassC@handleMethod', ['success' => 'AsyncJobEventListenerC@handleSuccess']]); This package has many great features and options available with code examples.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners