PHPackages                             fereydooni/laravel-async-flow - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fereydooni/laravel-async-flow

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fereydooni/laravel-async-flow
=============================

A robust and feature-rich asynchronous programming capability for Laravel using PHP attributes

00PHPCI failing

Since Apr 24Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

AsyncFlow
=========

[](#asyncflow)

A robust and feature-rich asynchronous programming capability for Laravel using PHP attributes.

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

[](#installation)

```
composer require fereydooni/laravel-async-flow
```

The package will automatically register its service provider if you're using Laravel 5.5+.

Publish the configuration file:

```
php artisan vendor:publish --provider="AsyncFlow\Providers\AsyncFlowServiceProvider"
```

Run the migrations:

```
php artisan migrate
```

Requirements
------------

[](#requirements)

- PHP 8.1+
- Laravel 10.x
- Queue driver configured (Redis recommended)

Usage
-----

[](#usage)

### Define Async Methods

[](#define-async-methods)

Use the `Async` attribute to mark methods for asynchronous execution:

```
use AsyncFlow\Attributes\Async;
use AsyncFlow\Attributes\AsyncHandler;

class TaskService
{
    #[Async(queue: 'high', delay: 10, tries: 3, timeout: 120)]
    public function processData($data)
    {
        // Heavy computation or API call
        return $data * 2;
    }

    #[AsyncHandler(event: 'success')]
    public function handleSuccess($result)
    {
        Log::info('Task succeeded with result: ' . $result);
    }

    #[AsyncHandler(event: 'failed')]
    public function handleFailure($exception)
    {
        Log::error('Task failed: ' . $exception->getMessage());
    }
}
```

### Dispatch Async Tasks

[](#dispatch-async-tasks)

```
use AsyncFlow\AsyncManager;

// Inject the AsyncManager
$manager = app(AsyncManager::class);

// Dispatch an async task
$task = $manager->dispatch(TaskService::class, 'processData', [10]);

// Get task status
$status = $manager->getTaskStatus($task->id); // 'pending', 'running', 'completed', 'failed'

// Get task result (only available if task is completed)
$result = $manager->getTaskResult($task->id); // Returns 20 if completed
```

### Async HTTP Requests

[](#async-http-requests)

```
use AsyncFlow\Attributes\Async;

class ApiService
{
    #[Async(queue: 'api')]
    public function fetchData($url)
    {
        return Http::get($url)->json();
    }
}
```

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

[](#configuration)

The configuration file (`config/async-flow.php`) allows you to:

- Enable/disable async execution globally
- Set default queue, delay, tries, and timeout settings
- Configure queue driver
- Set log storage backend

Available Attribute Options
---------------------------

[](#available-attribute-options)

### Async Attribute

[](#async-attribute)

- `queue` (string): The queue to use (default: 'default')
- `delay` (int): Seconds to delay execution (default: 0)
- `tries` (int): Maximum retry attempts (default: 3)
- `timeout` (int): Maximum execution time in seconds (default: 60)

### AsyncHandler Attribute

[](#asynchandler-attribute)

- `event` (string): Event type to handle ('success', 'failed', default: 'success')
- `callback` (string): Optional callback method/function

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d9ae6dcf5d71a4eda508bc3b84bc78470548ebd7ed1824f3c194e03fd6815bfb?d=identicon)[Behnamfe76](/maintainers/Behnamfe76)

---

Top Contributors

[![Behnamfe76](https://avatars.githubusercontent.com/u/101217538?v=4)](https://github.com/Behnamfe76 "Behnamfe76 (3 commits)")

### Embed Badge

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

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

###  Alternatives

[musonza/chat

Chat Package for Laravel

1.2k253.4k1](/packages/musonza-chat)[automattic/vip-go-mu-plugins

The mu-plugins that power the VIP Go Platform

147207.5k](/packages/automattic-vip-go-mu-plugins)[minwork/array

Pack of advanced array functions specifically tailored for: associative (assoc) array, multidimensional array, array of objects and handling nested array elements

66256.1k5](/packages/minwork-array)[illuminatech/url-trailing-slash

Allows enforcing URL routes with or without trailing slash

50216.9k](/packages/illuminatech-url-trailing-slash)

PHPackages © 2026

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