PHPackages                             powderblue/curl - 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. powderblue/curl

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

powderblue/curl
===============

A basic CURL wrapper for PHP. This is a modernised, and maintained, version of @shuber's rather nice, simple cURL wrapper, https://github.com/shuber/curl.

v2.0.3(2y ago)0434MITPHPPHP &gt;=7.4.27

Since Jun 17Pushed 2y agoCompare

[ Source](https://github.com/powderblue/curl)[ Packagist](https://packagist.org/packages/powderblue/curl)[ RSS](/packages/powderblue-curl/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (10)Used By (0)

Curl
====

[](#curl)

A basic cURL wrapper for PHP.

> ℹ️ See  for more information about the cURL extension for PHP

This fork is a modernised, and maintained, version of [@shuber's](https://github.com/shuber) rather nice, simple [cURL wrapper](https://github.com/shuber/curl).

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

[](#installation)

Use [Composer](https://getcomposer.org/).

Usage
-----

[](#usage)

### Initialization

[](#initialization)

Simply require and initialize the `Curl` class like so:

```
require '/vendor/autoload.php';

$curl = new PowderBlue\Curl\Curl();
```

### Performing a Request

[](#performing-a-request)

The `Curl` class provides shortcuts for making requests using the `HEAD`, `GET`, `POST`, `PUT`, and `DELETE` methods. You must always specify a URL; you can also pass an array/string of variables to send along with it, if need be.

```
// When making `HEAD` and `GET` requests, parameters will be appended to the URL in the form of a query-string
$response = $curl->head($url, $requestParams);
$response = $curl->get($url, $requestParams);
// Otherwise, you can pass an associative array or a string to pop into the body of the request
$response = $curl->post($url, $requestBody);
$response = $curl->put($url, $requestBody);
$response = $curl->delete($url, $requestBody);
```

Use `Curl::request()` to make a request using a custom request-method, thus:

```
$response = $curl->request('', $url, $requestBody);
```

Examples:

```
$response = $curl->get('https://www.google.com/?q=test');

// In this case, '?q=test' will be appended to the URL
$response = $curl->get('https://www.google.com/', ['q' => 'test']);

// The data will be encoded for you and the `Content-Type` header set to `multipart/form-data`
$response = $curl->post('test.com/posts', ['title' => 'Test', 'body' => 'This is a test']);
```

All requests return an instance of [`PowderBlue\Curl\Response`](#The-Response-Class) if successful, or throw an exception if an error occurs.

### The Response Class

[](#the-response-class)

A normal cURL request returns the headers and body in a single string. The `PowderBlue\Curl\Response` class splits that string, placing the two parts in separate properties.

For example:

```
$response = $curl->get('https://www.google.com/');
echo $response->body;
print_r($response->headers);
```

Would display something like:

```

Google.com

...

Array
(
    [Http-Version] => 1.0
    [Status-Code] => 200
    [Status] => 200 OK
    [Cache-Control] => private
    [Content-Type] => text/html; charset=ISO-8859-1
    [Date] => Wed, 07 May 2008 21:43:48 GMT
    [Server] => gws
    [Connection] => close
)
```

> ℹ️ `PowderBlue\Curl\Response::__toString()` returns the response body, so—for example—`echo $response` will output the same as `echo $response->body`.

### Cookies/Sessions

[](#cookiessessions)

By default, cookies will be stored in `/var/curl_cookie.txt`. You can change this by doing something like the following.

```
$curl->cookie_file = '';
```

This allows you to maintain a session across requests.

### Basic Configuration Options

[](#basic-configuration-options)

You can easily set the referer or user-agent:

```
$curl->referer = '';
$curl->user_agent = '';
```

### Setting Headers

[](#setting-headers)

You can specify headers to send with the request:

```
$curl->headers['Host'] = 12.345.678.90;
$curl->headers['Custom-Header'] = 'foo';
$curl->headers['User-Agent'] = '';
```

### Setting Custom cURL Request Options

[](#setting-custom-curl-request-options)

By default, redirects will be followed. You can disable this with:

```
$curl->follow_redirects = false;
```

If you need to do something a little more exotic, you can set/override cURL options like this:

```
$curl->options[CURLOPT_AUTOREFERER] = true;
```

> ℹ️ See the [`curl_setopt()` documentation](https://www.php.net/curl_setopt) for a list of cURL request options

Get in Touch
------------

[](#get-in-touch)

Problems, comments, and suggestions are all welcome: .

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~2 days

Total

9

Last Release

1093d ago

Major Versions

v1.2.1 → v2.0.02023-06-24

PHP version history (2 changes)v1.0.0PHP &gt;=7.4.33

v1.0.1PHP &gt;=7.4.27

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc7f0a9494e2af3da095dedd701c49c29f3df854d71d9888268bf2b06657d0fd?d=identicon)[powderblue](/maintainers/powderblue)

---

Top Contributors

[![shuber](https://avatars.githubusercontent.com/u/2419?v=4)](https://github.com/shuber "shuber (14 commits)")[![weppos](https://avatars.githubusercontent.com/u/5387?v=4)](https://github.com/weppos "weppos (7 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/powderblue-curl/health.svg)

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M90](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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