SkillAgentSearch skills...

Fiberflow

๐Ÿš€ Revolutionary Laravel queue package leveraging PHP 8.1+ Fibers for 10-50x throughput improvement. Zero state pollution, async I/O, real-time dashboard.

Install / Use

/learn @virgilhawkins00/Fiberflow
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

FiberFlow

Latest Release GitHub Tests Action Status PHP Version Laravel Version License

FiberFlow is a revolutionary Laravel queue worker that leverages PHP 8.1+ Fibers to enable true cooperative multitasking within a single process. Process 10,000 HTTP requests using only 100MB of RAM by suspending jobs during I/O operations instead of blocking the entire worker.

๐Ÿš€ The Problem

Traditional Laravel queue workers operate sequentially: one job at a time, one process per job. When a job makes an HTTP request that takes 2 seconds to respond, the worker process (consuming 30-50MB of RAM) sits idle, waiting. To scale, you spawn more processes, consuming gigabytes of memory.

FiberFlow changes the game.

โœจ The Solution

Using PHP Fibers and the Revolt event loop, FiberFlow allows multiple jobs to run concurrently in a single worker process. When a job waits for I/O (HTTP requests, database queries with async drivers), the Fiber suspends, allowing other jobs to execute. The result:

  • 70% reduction in infrastructure costs for I/O-heavy workloads
  • 10x throughput for webhook processing, API integrations, and web scraping
  • Zero configuration for basic usage - drop-in replacement for queue:work
  • Pure PHP - no Swoole, no RoadRunner, no PECL extensions required

๐Ÿ“‹ Requirements

  • PHP 8.2+ (Fibers introduced in 8.1, but 8.2+ recommended for stability)
  • Laravel 11.x or 12.x
  • Composer 2.0+

๐Ÿ“ฆ Installation

Install via Composer:

composer require fiberflow/fiberflow

Publish the configuration file (optional):

php artisan vendor:publish --tag=fiberflow-config

๐ŸŽฏ Quick Start

Replace your standard queue worker command:

# Before
php artisan queue:work

# After
php artisan fiber:work

That's it! Your jobs now run concurrently using Fibers.

๐Ÿ’ก Usage Example

Standard Job (Fiber-Safe)

use FiberFlow\Concerns\AsyncJob;
use FiberFlow\Facades\AsyncHttp;

class ProcessWebhook implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, AsyncJob;

    public function handle()
    {
        // This suspends the Fiber, freeing the worker for other jobs
        $response = AsyncHttp::post('https://api.stripe.com/v1/charges', [
            'amount' => 2000,
            'currency' => 'usd',
        ]);

        // Execution resumes here when the response arrives
        if ($response->successful()) {
            // Process the response...
        }
    }
}

Configuration

// config/fiberflow.php
return [
    'max_concurrency' => 50,  // Maximum concurrent Fibers
    'memory_limit' => 256,    // MB per worker
    'timeout' => 60,          // Seconds per job
    'dashboard' => true,      // Enable TUI dashboard
];

๐ŸŽจ TUI Dashboard

Launch the worker with real-time monitoring:

php artisan fiber:work --dashboard

Displays:

  • Active vs. suspended Fibers
  • Memory usage
  • Jobs/second throughput
  • Queue depth

โš ๏ธ Important Considerations

โœ… Ideal Use Cases

  • Webhooks & Notifications: Sending thousands of HTTP requests to third-party APIs
  • Web Scraping: Fetching data from multiple sources simultaneously
  • API Proxying: Acting as an async middleware between services
  • Email Campaigns: Sending bulk emails via external SMTP services

โŒ Not Recommended For

  • CPU-Intensive Tasks: Image/video processing (blocks the event loop)
  • Legacy Database Operations: Heavy Eloquent queries using blocking PDO (use async drivers or defer pattern)
  • File System Operations: Large file reads/writes (blocking I/O)

๐Ÿ”’ Container Isolation

FiberFlow uses Container Sandboxing to prevent state pollution between concurrent jobs. Each Fiber gets its own cloned container instance, ensuring:

  • No shared singletons between jobs
  • Isolated authentication state
  • Safe multi-tenant operations

๐Ÿ“š Documentation

๐Ÿงช Testing

composer test

Run tests across PHP versions:

composer test:coverage

๐Ÿค Contributing

Please see CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

๐Ÿ“„ License

FiberFlow is open-sourced software licensed under the MIT license.

๐Ÿ™ Credits


Made with โค๏ธ for the Laravel community

Related Skills

View on GitHub
GitHub Stars5
CategoryDevelopment
Updated24d ago
Forks2

Languages

PHP

Security Score

90/100

Audited on Mar 13, 2026

No findings