Familiar API
Write requests in PHP the same way you do in JavaScript with fetch(), async, and await.
Fetch PHP
A modern HTTP client that mirrors the JavaScript fetch API while staying native to PHP 8.3+. Compose requests fluently, run async flows, and ship production-grade HTTP without the ceremony.

Quickstart
Install and ship in minutes
composer require jerome/fetch-phpTrusted by PHP teams
Fetch PHP is designed for teams shipping APIs, SaaS backends, and internal tools who want a modern HTTP experience without sacrificing PHP standards.
Why Fetch PHP
Write requests in PHP the same way you do in JavaScript with fetch(), async, and await.
Promise-first API with then(), catch(), finally(), and helpers for concurrency.
Chain config and requests for readable, composable HTTP code.
Global helpers like fetch(), get(), post() for quick calls.
Implements PSR-7 (HTTP Messages), PSR-18 (HTTP Client), and PSR-3 (Logging) standards.
Rich response helpers for json(), text(), array(), object(), and status checks.
Sync-only cache with ETag/Last-Modified revalidation, stale-while-revalidate, and stale-if-error support.
Shared connection pooling, DNS cache, and optional HTTP/2 with validation and stats for debugging.
Unified debug snapshots and optional profiler with timing, memory, and connection stats; configurable log level.
Copy/paste ready
Use the Matrix async helpers to keep promise-based workflows familiar. The response helpers map directly to fetch(), so JSON parsing feels identical.
const response = await fetch('https://api.example.com/users');const users = await response.json(); if (!response.ok) { throw new Error('Request failed');} render(users);
Performance & compatibility
Exponential
Retry backoff
RFC 7234
Caching
PSR-7/18/3
Standards
Proven HTTP engine with retries, middleware, and transport control.
Reusable sockets and DNS cache for lower latency across requests.
Optional HTTP/2 for faster multiplexed connections when curl supports it.
Debug snapshots, structured logging, and profiler hooks built-in.
DX highlights
Ready to ship?
Install with Composer, then dive into the guide for async patterns, retries, and advanced configuration.
composer require jerome/fetch-php