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