PHPackages                             ndtan/php-curl-framework - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ndtan/php-curl-framework

ActiveLibrary

ndtan/php-curl-framework
========================

NDT PHP cURL Framework — chainable HTTP client &amp; PSR-18 adapter built on ext-curl: retries with decorrelated jitter, hedged requests, circuit breaker, async pool, TLS pinning, caching, VCR, logging, and Laravel/Symfony integrations.

13PHPCI passing

Since Sep 21Pushed 7mo agoCompare

[ Source](https://github.com/nguyenduytan/NDT-PHP-Curl-Framework)[ Packagist](https://packagist.org/packages/ndtan/php-curl-framework)[ RSS](/packages/ndtan-php-curl-framework/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

NDT PHP cURL Framework
======================

[](#ndt-php-curl-framework)

Chainable HTTP client &amp; PSR‑18 adapter on top of **ext‑curl** — production‑ready with **decorrelated jitter retries**, **(API) hedged requests**, **circuit breaker**, **HTTP/2**, **TLS pinning**, **large‑file streaming**, **HTTP cache**, **VCR**, and **Laravel/Symfony** integrations.

 [![PHP](https://camo.githubusercontent.com/3e41095f4ad1c6ad78f988bd1c107f87972f334143c3ba814165a03e1f43a63c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net/releases/8.1/en.php) [![License](https://camo.githubusercontent.com/5caa455d8debc46fb23abbadb45a733a937f3910a73fc875c2f7820468e1bb54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e)](LICENSE.md) [![Status](https://camo.githubusercontent.com/697c292d33f6485ac5b6b463d5aed2dc01117b99b780db6b7aa22010df8d59c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f485454502d52657472792532302545322538302541322532304369726375697425323025453225383025413225323043616368652532302545322538302541322532305643522d306235666666)](https://camo.githubusercontent.com/697c292d33f6485ac5b6b463d5aed2dc01117b99b780db6b7aa22010df8d59c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f485454502d52657472792532302545322538302541322532304369726375697425323025453225383025413225323043616368652532302545322538302541322532305643522d306235666666) [![Type](https://camo.githubusercontent.com/3671398bcd4c40447d07e98ae360d2ea7f35303ab30a6d4305bd5d7c97a6e940/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4672616d65776f726b732d4c61726176656c25323025374325323053796d666f6e792d384132424532)](https://camo.githubusercontent.com/3671398bcd4c40447d07e98ae360d2ea7f35303ab30a6d4305bd5d7c97a6e940/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4672616d65776f726b732d4c61726176656c25323025374325323053796d666f6e792d384132424532) [![PSR](https://camo.githubusercontent.com/5c836bd153d306ca4dfd169dbb8c7733a1dafbf0f33e05e6c135a89370640f27/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d3138253230636c69656e74253230253743253230372532306d657373616765732d344439303845)](https://camo.githubusercontent.com/5c836bd153d306ca4dfd169dbb8c7733a1dafbf0f33e05e6c135a89370640f27/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5053522d3138253230636c69656e74253230253743253230372532306d657373616765732d344439303845)

 [![CI](https://github.com/nguyenduytan/NDT-PHP-Curl-Framework/actions/workflows/php.yml/badge.svg)](https://github.com/nguyenduytan/NDT-PHP-Curl-Framework/actions)

---

Table of Contents
-----------------

[](#table-of-contents)

- [Why NDT?](#why-ndt)
- [Features](#features)
- [Installation](#installation)
- [Quick Start (Plain PHP)](#quick-start-plain-php)
- [Cheat Sheet](#cheat-sheet)
- [JSON &amp; Body Modes](#json--body-modes)
- [Cookies (Netscape / JSON)](#cookies-netscape--json)
- [Custom cURL Options](#custom-curl-options)
- [Reliability: Retry · Backoff · Circuit · Hedging](#reliability-retry--backoff--circuit--hedging)
- [Large Files (Download/Upload &gt; 1GB)](#large-files-downloadupload--1gb)
- [HTTP Cache &amp; VCR](#http-cache--vcr)
- [Observability (Timings, Hooks, Otel)](#observability-timings-hooks-otel)
- [Security &amp; TLS](#security--tls)
- [Framework Integrations](#framework-integrations)
    - [Laravel](#laravel)
    - [Symfony](#symfony)
- [PSR‑18 Adapter](#psr18-adapter)
- [Config Reference](#config-reference)
- [Examples](#examples)
- [Testing](#testing)
- [License](#license)

---

Why NDT?
--------

[](#why-ndt)

- **DX first**: fluent builder like `Http::to(...)->asJson()->post(...)`.
- **Reliability**: retries (decorrelated jitter) · hedging (API) · circuit breaker · deadlines.
- **Performance**: HTTP/2, keep‑alive, happy‑eyeballs, streaming, resume, progress.
- **Security**: TLS policy, pinned public key, proxy/DoH, DNS overrides.
- **Ops friendly**: cache, VCR, hooks, timings, PSR‑3 logs, Otel‑ready.
- **Portable**: PSR‑18 client &amp; Laravel/Symfony bridges.

---

Features
--------

[](#features)

- ✅ **Retry with decorrelated jitter** — honors `Retry-After`
- ✅ **Circuit breaker** (half‑open probe) per host/service
- ✅ **Hedged requests (API ready)** — duplicate after X ms if no TTFB *(curl\_multi execution lands in v0.2)*
- ✅ **HTTP/2**, keep‑alive, happy‑eyeballs (if supported by libcurl)
- ✅ **Auto‑decompression** (gzip/br/deflate), **Content‑Length sanity**
- ✅ **Large files**: streaming **download/upload**, resume, progress
- ✅ **Cookies**: **Netscape** or **JSON** jar (autodetect)
- ✅ **HTTP cache** (PSR‑16/PSR‑6), **VCR** record/replay
- ✅ **Security**: TLS policy, **pinned public key**, proxy &amp; DoH, DNS overrides
- ✅ **Observability**: timings (dns/connect/tls/ttfb/transfer/total), hooks, PSR‑3 logging, OpenTelemetry (optional)
- ✅ **PSR‑18** client + **Laravel/Symfony** bridges

> New preview features &amp; examples are linked in docs at the end of each section.

---

Installation
------------

[](#installation)

```
composer require ndtan/php-curl-framework
```

> Requires PHP **8.1+**, `ext-curl`, `ext-json`.

---

Quick Start (Plain PHP)
-----------------------

[](#quick-start-plain-php)

```
