PHPackages                             coderatio/curler - 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. coderatio/curler

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

coderatio/curler
================

A clean PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services

1.0.1(5y ago)54.4k3[1 issues](https://github.com/coderatio/curler/issues)[1 PRs](https://github.com/coderatio/curler/pulls)MITPHPPHP ^7.1|^7.2

Since Jan 5Pushed 5y ago2 watchersCompare

[ Source](https://github.com/coderatio/curler)[ Packagist](https://packagist.org/packages/coderatio/curler)[ RSS](/packages/coderatio-curler/feed)WikiDiscussions master Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Curler
======

[](#curler)

An elegant PHP HTTP client for sending HTTP requests.

Requirements
------------

[](#requirements)

- `php 7.1+`
- `OpenSSL`
- `cURL`

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

[](#installation)

This library can easily be installed using composer. Run the command below:

```
composer require coderatio/curler
```

---

### `GET`

[](#get)

Because this is built with simplicity in mind from the beginning, below is how easy you can make a get request to another server.

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

$curler = new \Coderatio\Curler\Curler();
$curler->get('https://jsonplaceholder.typicode.com/todos');
$response = $curler->getResponse();
```

### `POST`

[](#post)

```
$data = [
  'title' => 'Sample post',
  'body' => 'This is a sample post',
  'userId' => 1
];

$curler = new \Coderatio\Curler\Curler();
$request = $curler->post('https://jsonplaceholder.typicode.com/posts', $data);
$response = $curler->getResponse();
```

### `POST FORM`

[](#post-form)

Sending form data via curler is as simple sending a `post` request. Just send an array of your form data and curler will take care of the rest. Take a look below:

```
$data = [
  'first_name' => 'John',
  'last_name' => 'Doe',
  'email' => 'johndoe@example.com'
];

$curler = new \Coderatio\Curler\Curler();
$request = $curler->postForm('https://example.com/store-user', $data);
$response = $curler->getResponse();
```

By default, the `$response` variable will hold a json object of the request. But, there are instances where you want the response in php object or array. You can get them as below:

```
$response = $curler->getResponse()->asObject();
```

OR

```
$response = $curler->getResponse()->asArray();
```

---

Other Request Methods
---------------------

[](#other-request-methods)

1. PUT
2. DELETE
3. DOWNLOAD
4. OPTIONS
5. HEAD
6. TRACE

Just as you use the post, get, postForm e.t.c, you can also use the `put`, `delete`, `download`, `options`, `head`, and `trace` methods.

---

Adding Custom Headers
---------------------

[](#adding-custom-headers)

Sometimes, you may need to send your request with custom headers. Curler, has full support for that and many more. Here is how it can be done.

- ### Single Header

    [](#single-header)

```
$curler = new \Coderatio\Curler\Curler();
$curler->appendRequestHeader('Content-Type', 'application/json');
$curler->post('https://jsonplaceholder.typicode.com/posts', $data);

$response = $curler->getResponse();
```

- ### Multiple headers

    [](#multiple-headers)

```
$curler = new \Coderatio\Curler\Curler();
$curler->appendRequestHeaders([
    'Content-Type' => 'application/xml',
    'x-access-token' => 'xxxxxxxxxx'
]);

$curler->post('https://jsonplaceholder.typicode.com/posts', $data);

$response = $curler->getResponse();
```

---

Get Status Code
---------------

[](#get-status-code)

Sometimes, you may like to get the status code returned from a request. This can easily be done with curler as below:

```
$curler->statuseCode;
```

---

Add cURL options
----------------

[](#add-curl-options)

Since this package is built with flexibility in mind, adding cURL options should be a breeze. Here is how you can add options:

```
$curler->addCurlOption('CURLOPT_PUT', true); // Single

// OR

$curler->addCurlOptions([
    'CURLOPT_PUT' => true,
    'CURLOPT_POSTFIELDS' => []
]);
```

Contributors
------------

[](#contributors)

To be a contributor, kindly fork the repo, add or fix bugs and send a pull request.

Contribution
------------

[](#contribution)

To contribute to this project, kindly fork it and send a pull request or find me on [Twitter](https://twitter.com/josiahoyahaya).

License
-------

[](#license)

This project is licenced with the MIT license.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% 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 ~451 days

Total

2

Last Release

1919d ago

### Community

Maintainers

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

---

Top Contributors

[![coderatio](https://avatars.githubusercontent.com/u/36877085?v=4)](https://github.com/coderatio "coderatio (9 commits)")[![Basttyy](https://avatars.githubusercontent.com/u/23058396?v=4)](https://github.com/Basttyy "Basttyy (1 commits)")[![prondubuisi](https://avatars.githubusercontent.com/u/22311928?v=4)](https://github.com/prondubuisi "prondubuisi (1 commits)")

### Embed Badge

![Health badge](/badges/coderatio-curler/health.svg)

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

###  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)
