PHPackages                             saeedvaziry/laravel-async - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. saeedvaziry/laravel-async

ActiveLibrary[Queues &amp; Workers](/categories/queues)

saeedvaziry/laravel-async
=========================

Run asynchronous code in Laravel without waiting for results

1.4.0(1mo ago)15310.0k↓40.5%12[6 issues](https://github.com/saeedvaziry/laravel-async/issues)MITPHPPHP ^8.1CI failing

Since Nov 29Pushed 7mo ago8 watchersCompare

[ Source](https://github.com/saeedvaziry/laravel-async)[ Packagist](https://packagist.org/packages/saeedvaziry/laravel-async)[ RSS](/packages/saeedvaziry-laravel-async/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (12)Versions (10)Used By (0)

Laravel Async
=============

[](#laravel-async)

[![Packagist License](https://camo.githubusercontent.com/ad7b539a762caf98e1156ee6e04a85d8bd967ef9748bd1604fb71054c1a2d57b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736165656476617a6972792f6c61726176656c2d6173796e633f7374796c653d706c6173746963)](https://packagist.org/packages/saeedvaziry/laravel-async)[![Packagist Version](https://camo.githubusercontent.com/d53f0bb2a053df10224787f1ba8be160a895790889c6c814223c7637a0385467/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736165656476617a6972792f6c61726176656c2d6173796e633f7374796c653d706c6173746963)](https://packagist.org/packages/saeedvaziry/laravel-async)[![Packagist Downloads](https://camo.githubusercontent.com/d1d30f87b353ec64fa4c333ebf844db48d141b2cdcef36f40b7fc7227be339ed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f736165656476617a6972792f6c61726176656c2d6173796e633f7374796c653d706c6173746963)](https://packagist.org/packages/saeedvaziry/laravel-async/stats)[![PHP Dependency Version](https://camo.githubusercontent.com/3a6ca9c903a238285b62e05adce40f885141709987996c9e7c8513bcb4401346/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f736165656476617a6972792f6c61726176656c2d6173796e632f7068703f7374796c653d706c6173746963266c6162656c3d504850)](https://packagist.org/packages/saeedvaziry/laravel-async)[![GitHub Actions Workflow Status](https://github.com/saeedvaziry/laravel-async/actions/workflows/tests.yml/badge.svg)](https://github.com/saeedvaziry/laravel-async/actions/workflows/tests.yml)[![GitHub Repo Stars](https://camo.githubusercontent.com/4892eaef92d89ef17798d5a0c69ec4ae31cd63c9801ae42f67714e84effc94a8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f736165656476617a6972792f6c61726176656c2d6173796e63)](https://github.com/saeedvaziry/laravel-async)

    laravel-async-demo.mp4    Laravel Async is a simple package for Laravel that enables you to run your code asynchronously without using the workers and Supervisor!

Unlike the Laravel Process, Symfony Process, or other similar packages, You don't need to wait for the sub-processes in the main process to finish!

```
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;

AsyncHandler::dispatch(function () {
    sleep(10);

    info("Hello from Async process after 10 seconds!");
});

info("dispatched the process!");
```

Demo
----

[](#demo)

How it works?
-------------

[](#how-it-works)

You can call it a hack or a trick! but Laravel Async uses the background process of the OS to run your code.

It provides a simple Laravel Console Command that unserializes your code and runs it in the background of the OS.

Do note, because we do not wait for the async code to finish, if you need to know the results of your async code, you should read/write the results using other ways, e.g. through a database.

Supported OS
------------

[](#supported-os)

Currently, it only supports Linux and Unix-based operating systems.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require saeedvaziry/laravel-async
```

Configuration
-------------

[](#configuration)

To publish the configuration file, you can run the following command:

```
php artisan vendor:publish --provider="SaeedVaziry\LaravelAsync\LaravelAsyncServiceProvider"
```

This will create a `laravel-async.php` file in your `config` directory.

**php\_path**

The path to the PHP executable. The default value which is the path to the PHP binary should work for CLI usage. However, If you want to use it in web, You should set the path to the PHP binary because the default value will be the path to the web server's PHP binary like php-fpm.

You can also set via the `.env` file.

```
LARAVEL_ASYNC_PHP_PATH=/path/to/php
```

Usage
-----

[](#usage)

The usage is very simple and straightforward. You can provide the Closure or your Laravel Job class to the `AsyncHandler` facade.

### Closure

[](#closure)

```
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;

AsyncHandler::dispatch(function () {
    info("Hello from Async process!");
});
```

### Job

[](#job)

You can send Jobs or any other classes that have a `handle` method.

```
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;

AsyncHandler::dispatch(new MyJob());
```

### Timeouts

[](#timeouts)

The default timeout is 60 seconds.

This will set a timeout of 10 seconds to the process and if it didn't finish in 10 seconds it will kill the process.

```
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;

AsyncHandler::timeout(10)->dispatch(function () {
    info("Hello from Async process!");
});
```

You can also dispatch without a timeout!

!!! Be careful about this because if your code gets stuck in an infinite loop, it will drain your server resources.

```
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;

AsyncHandler::withoutTimeout()->dispatch(function () {
    info("Hello from Async process!");
});
```

Testing
-------

[](#testing)

You can fake the `AsyncHandler`'s facade in your tests and check if the code is dispatched or not.

```
use SaeedVaziry\LaravelAsync\Facades\AsyncHandler;

AsyncHandler::fake();

// Your code that dispatches the AsyncHandler

AsyncHandler::assertDispatchedCounts(1);
```

You can test to see how many times you dispatched an async process.

Contributing
------------

[](#contributing)

Please feel free to submit an issue or open a PR.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance74

Regular maintenance activity

Popularity42

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~105 days

Recently: every ~211 days

Total

9

Last Release

56d ago

Major Versions

0.0.2 → 1.0.02023-11-30

PHP version history (2 changes)0.0.1PHP ^8.0

1.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/61919774?v=4)[Saeed Vaziry](/maintainers/saeedvaziry)[@saeedvaziry](https://github.com/saeedvaziry)

---

Top Contributors

[![saeedvaziry](https://avatars.githubusercontent.com/u/61919774?v=4)](https://github.com/saeedvaziry "saeedvaziry (26 commits)")[![Vectorial1024](https://avatars.githubusercontent.com/u/17726797?v=4)](https://github.com/Vectorial1024 "Vectorial1024 (6 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/saeedvaziry-laravel-async/health.svg)

```
[![Health](https://phpackages.com/badges/saeedvaziry-laravel-async/health.svg)](https://phpackages.com/packages/saeedvaziry-laravel-async)
```

###  Alternatives

[illuminate/queue

The Illuminate Queue package.

20331.4M1.2k](/packages/illuminate-queue)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[prwnr/laravel-streamer

Events streaming package for Laravel that uses Redis 5 streams

110196.9k1](/packages/prwnr-laravel-streamer)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[pmatseykanets/artisan-beans

Easily manage your Beanstalkd job queues right from the Laravel artisan command

4482.1k](/packages/pmatseykanets-artisan-beans)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
