~/docs
Resonate
Resonate
13.x 13.43.0.3, current
Fledge Fiber
Toggle sidebar
Fledge Fiber
webpatser/fledge-fiber 13.43.0.3

Fledge Fiber 13.x

Packages

The modules in the fledge-fiber monorepo, their namespaces and what each one does.

fledge-fiber is one Composer package, webpatser/fledge-fiber. It contains the modules below, autoloaded as PSR-4 namespaces from src/Fledge/Async/ and src/Fledge/Fiber/.

Async modules

Module Namespace Description
Core Fledge\Async Future, async/await, cancellation, pipelines
Stream Fledge\Async\Stream Non-blocking byte streams, sockets, TLS
Database Fledge\Async\Database MySQL, MariaDB, PostgreSQL wire protocols (Database\Mysql, Database\Postgres)
Redis Fledge\Async\Redis RESP protocol, pub/sub, TLS, cluster
HTTP Fledge\Async\Http HTTP/1.1 and HTTP/2 client (Http\Client) and server (Http\Server)
WebSocket Fledge\Async\WebSocket WebSocket client and server
File Fledge\Async\File Non-blocking filesystem I/O
Parallel Fledge\Async\Parallel Multi-process worker pools
DNS Fledge\Async\Dns Async DNS resolution
Cache Fledge\Async\Cache Cache interfaces and local implementations
Sync Fledge\Async\Sync Mutexes, semaphores, barriers
Process Fledge\Async\Process OS process management
Serialization Fledge\Async\Serialization Serializers used by the other modules

Laravel integration

The layer under Fledge\Fiber\ bridges the async modules to Laravel.

Namespace Description
Fledge\Fiber\Database Connectors, connections and the PDO shim for fledge-mysql, fledge-mariadb and fledge-pgsql
Fledge\Fiber\Redis The fledge Redis client for Laravel, including cluster connections
Fledge\Fiber\Http FledgeHandler, FledgeGuzzle, FiberMailManager, AsyncClientFactory and the Symfony adapter (Fledge\Fiber\Http\Symfony\FledgeSymfonyHttpClient)
Fledge\Fiber\Livewire Concurrent Livewire component updates
Fledge\Fiber\Search FledgeElasticConnection and ElasticClientFactory for the Elasticsearch driver

Configuration is merged from config/fledge-http.php and config/fledge-livewire.php (no vendor:publish tag for the HTTP file). The Livewire config can be published with php artisan vendor:publish --tag=fledge-livewire-config.

Event loop

The loop is a separate package, fledge-loop, in the Fledge\Loop namespace.

Livewire

Concurrent component updates are off by default (fledge-livewire.concurrent is false). Blade and Livewire rendering rely on global state that interleaving fibers can corrupt, so enable it only when every component updated in one request is safe to render interleaved. max_concurrent (default 10) limits how many components update at once.

PHP 8.6 features in use

  • #[\NoDiscard] on Future-returning methods
  • clone() with property overrides for immutable configs
  • readonly class for value objects
  • Typed class constants
  • First-class callable syntax