PHPackages                             phpgt/curlinterface - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. phpgt/curlinterface

Abandoned → [phpgt/curl](/?search=phpgt%2Fcurl)Library[HTTP &amp; Networking](/categories/http)

phpgt/curlinterface
===================

cURL object wrapper.

v3.2.0(5mo ago)112MITPHPPHP &gt;=8.4CI passing

Since Dec 10Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/PhpGt/Curl)[ Packagist](https://packagist.org/packages/phpgt/curlinterface)[ GitHub Sponsors](https://github.com/sponsors/PhpGt)[ RSS](/packages/phpgt-curlinterface/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (5)Versions (28)Used By (0)

cURL object wrapper.
====================

[](#curl-object-wrapper)

This library wraps PHP's native cURL extension functions with objects, for better code readability and testability.

Why? We wanted to lay an object oriented foundation for [PHP.Gt/Fetch](https://php.gt/fetch), our PHP implementation of the web's fetch API that uses cURL to create asynchronous HTTP calls with promises.

---

[ ![Build status](https://camo.githubusercontent.com/476d4795c9c1332fca41732ecfb25fe41d7675da2dbe23de6ed38216047d9a42/68747470733a2f2f62616467652e7374617475732e7068702e67742f6375726c2d6275696c642e737667)](https://github.com/PhpGt/Curl/actions)[ ![Code quality](https://camo.githubusercontent.com/b61d52a05fef405401b59510958f0c400452ddf626121766e9d6c3d231a7575e/68747470733a2f2f62616467652e7374617475732e7068702e67742f6375726c2d7175616c6974792e737667)](https://app.codacy.com/gh/PhpGt/Curl)[ ![Code coverage](https://camo.githubusercontent.com/632c25ae6fcb0857e8677523ac19b8a58d0df39bee65a0dc4ae46bef3f48d8b8/68747470733a2f2f62616467652e7374617475732e7068702e67742f6375726c2d636f7665726167652e737667)](https://app.codecov.io/gh/PhpGt/Curl)[ ![Current version](https://camo.githubusercontent.com/d1efee8de69ab60e856c80fc017ab7875fc8019af90cad579717da1d6b945606/68747470733a2f2f62616467652e7374617475732e7068702e67742f6375726c2d76657273696f6e2e737667)](https://packagist.org/packages/PhpGt/Curl)[ ![PHP.Gt/Curl documentation](https://camo.githubusercontent.com/dcd63ab12d967bade2e1f5d678756150c21a4fc7614627c75ea54aede5bf45b8/68747470733a2f2f62616467652e7374617475732e7068702e67742f6375726c2d646f63732e737667)](https://www.php.gt/curl)Example usage: Get a JSON object from a remote source

When working with HTTP calls, it is extremely common to work with JSON. This library removes the need of a lot of boilerplate code by buffering the output of `exec()` calls for easy retrieval later with `output()` or `outputJson()`.

Example using PHP.Gt/Curl:
--------------------------

[](#example-using-phpgtcurl)

```
$curl = new Curl("https://catfact.ninja/fact");
$curl->exec();
$json = $curl->outputJson();
echo "Here's a cat fact: {$json->getString("fact")}";
echo PHP_EOL;
echo "The fact's length is {$json->getInt("length")} characters.";
echo PHP_EOL;
```

Same example using PHP's native `curl_*` functions:
---------------------------------------------------

[](#same-example-using-phps-native-curl_-functions)

```
// Using native functionality to achieve the same:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://catfact.ninja/fact");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
if(false === $result) {
	die("CURL error: " . curl_error($ch));
}
$json = json_decode($result);
if(is_null($json)) {
	die("JSON decoding error: " . json_last_error_msg());
}

// Note: No type checks are made on the `fact` and `length` properties here.
echo "Here's a cat fact: {$json->fact}";
echo PHP_EOL;
echo "The fact's length is {$json->length} characters.";
echo PHP_EOL;
```

Proudly sponsored by
====================

[](#proudly-sponsored-by)

[JetBrains Open Source sponsorship program](https://www.jetbrains.com/community/opensource/)

[![JetBrains logo.](https://camo.githubusercontent.com/b5639e7738c6dfae9fe3f3e20175570b7376ce2577a772e09c25c2d4f14bf86e/68747470733a2f2f7265736f75726365732e6a6574627261696e732e636f6d2f73746f726167652f70726f64756374732f636f6d70616e792f6272616e642f6c6f676f732f6a6574627261696e732e737667)](https://www.jetbrains.com/community/opensource/)

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance81

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 53.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~154 days

Recently: every ~297 days

Total

20

Last Release

155d ago

Major Versions

v1.1.0 → v2.x-dev2018-07-25

v2.2.3 → v3.0.02018-08-08

PHP version history (6 changes)v1.0.0PHP &gt;=7.0.0

v1.1.0PHP &gt;=7.1.0

v3.0.2PHP &gt;=7.2.0

v3.0.5PHP &gt;=7.4

v3.0.6PHP &gt;=8.1

v3.2.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e42344b91ce4b91ab57875969f67a0a6a48de570a08bc65d673b06b72fd3a3f?d=identicon)[g105b](/maintainers/g105b)

---

Top Contributors

[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (17 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (10 commits)")[![g105b](https://avatars.githubusercontent.com/u/358014?v=4)](https://github.com/g105b "g105b (5 commits)")

---

Tags

curlcurl-multioop-libraryphp-7php-curlphp-curl-asyncphp-interfacephpgtwrapperhttpcurlinterfacecurl\_multi

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpgt-curlinterface/health.svg)

```
[![Health](https://phpackages.com/badges/phpgt-curlinterface/health.svg)](https://phpackages.com/packages/phpgt-curlinterface)
```

###  Alternatives

[rmccue/requests

A HTTP library written in PHP, for human beings.

3.6k34.5M258](/packages/rmccue-requests)[nategood/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

1.8k17.2M267](/packages/nategood-httpful)[mashape/unirest-php

Unirest PHP

1.3k9.7M161](/packages/mashape-unirest-php)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48247.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

83510.1M71](/packages/smi2-phpclickhouse)[pear/http_request2

Provides an easy way to perform HTTP requests.

764.2M48](/packages/pear-http-request2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
