1. Go to this page and download the library: Download saeedvaziry/laravel-async library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
saeedvaziry / laravel-async example snippets
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;
AsyncHandler::dispatch(function () {
sleep(10);
info("Hello from Async process after 10 seconds!");
});
info("dispatched the process!");
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;
AsyncHandler::dispatch(function () {
info("Hello from Async process!");
});
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;
AsyncHandler::dispatch(new MyJob());
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;
AsyncHandler::timeout(10)->dispatch(function () {
info("Hello from Async process!");
});
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;
AsyncHandler::withoutTimeout()->dispatch(function () {
info("Hello from Async process!");
});
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;
AsyncHandler::fake();
// Your code that dispatches the AsyncHandler
AsyncHandler::assertDispatchedCounts(1);