PHP code example of webpatser / fledge-framework

1. Go to this page and download the library: Download webpatser/fledge-framework 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/ */

    

webpatser / fledge-framework example snippets


use Illuminate\Support\Facades\Concurrency;

// 3 HTTP requests run concurrently, total time ≈ slowest request
$results = Concurrency::driver('fiber')->run([
    fn () => $httpClient->request(new Request('https://api1.example.com'))->getBody()->buffer(),
    fn () => $httpClient->request(new Request('https://api2.example.com'))->getBody()->buffer(),
    fn () => $httpClient->request(new Request('https://api3.example.com'))->getBody()->buffer(),
]);

// Every Cache::get() and Redis::get() routes through fledge-fiber by default.
// No code changes needed; the driver is transparent.
Cache::get('key');        // suspends the current Fiber on socket I/O
Redis::set('key', 'val'); // same

// Inside Concurrency::run(), multiple Redis calls parallelize automatically:
Concurrency::driver('fiber')->run([
    fn () => Cache::get('user:1'),
    fn () => Cache::get('user:2'),
    fn () => Cache::get('user:3'),
]); // all 3 reads overlap on socket I/O
bash
php artisan fledge:bench --scenario=uri --iterations=10000
php artisan fledge:bench --scenario=polyfills
php artisan fledge:bench --scenario=redis     # uses your configured cache driver

webpatser/fledge                  Laravel app skeleton (composer create-project target)
  └─ webpatser/fledge-framework   This repo: Laravel 13 fork, PHP 8.5 optimized
      └─ webpatser/fledge-fiber   Single async runtime: Redis, MySQL/MariaDB/PostgreSQL,
                                  HTTP client/server, DNS, Fiber primitives, Revolt loop

Optional companions:
  webpatser/torque                Fiber-based queue worker, Horizon alternative
  webpatser/laravel-fiber         Same FiberDriver as a standalone package for
                                  Laravel 11/12/13 (no PHP 8.5