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

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

zjango/curl
===========

Laravel Package For cURL

010.0k1[1 PRs](https://github.com/zjango/curl/pulls)PHP

Since Sep 28Pushed 8y ago1 watchersCompare

[ Source](https://github.com/zjango/curl)[ Packagist](https://packagist.org/packages/zjango/curl)[ RSS](/packages/zjango-curl/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel-Curl
============

[](#laravel-curl)

Laravel-Curl is an object-oriented wrapper of the PHP cURL extension.

Installation
============

[](#installation)

To install the package, simply add the following to your Laravel installation's `composer.json` file

```
"require": {
	"zjango/laracurl": "dev-master"
},
```

### In Laravel 5.0

[](#in-laravel-50)

Run the usual `composer update` to pull the files. Then, add the following **Service Provider** to your `providers` array in your `config/app.php` config.

```
'providers' => array(
	...
	'Zjango\Curl\CurlServiceProvider',
);
```

And finally add a new line to the aliases array:

```
		'Curl'	=>	'Zjango\Curl\Facades\Curl',
```

### In Laravel 5.2

[](#in-laravel-52)

Run the usual `composer update` to pull the files. Then, add the following **Service Provider** to your `providers` array in your `config/app.php` config.

```
'providers' => array(
	...
	Zjango\Curl\CurlServiceProvider::class,
);
```

And finally add a new line to the aliases array:

```
		'Curl'  =>  Zjango\Curl\Facades\Curl::class,
```

Quick Start and Examples
========================

[](#quick-start-and-examples)

**Simple GET Request**

```
	Curl::get('http://www.example.com/');
```

**Easily Build URL With Query String Attached**

```
	Curl::buildUrl('http://www.example.com/search', array(
		'q' => 'keyword',
	));
```

**Easily GET Request With Query String Attached**

```
	Curl::get('http://www.example.com/search', array(
		'q' => 'keyword',
	));
```

**post() accepts array of POST data**

```
	Curl::post('http://www.example.com/login/', array(
		'username' => 'myusername',
		'password' => 'mypassword',
	));
```

**Prefix 'json' to method to post as JSON**//todo

**Prefix 'raw' to method to post as JSON**//todo

```
$curl = new Curl;
$curl->setBasicAuthentication('username', 'password');
$curl->setUserAgent('');
$curl->setReferrer('');
$curl->setHeader('X-Requested-With', 'XMLHttpRequest');
$curl->setCookie('key', 'value');
$curl->get('http://www.example.com/');
if ($curl->error) {
    echo $curl->error_code;
}
else {
    echo $curl->body;
}
var_dump($curl->request_headers);
var_dump($curl->response_headers);
```

```
$curl = new Curl;
$curl->setopt(CURLOPT_RETURNTRANSFER, TRUE);
$curl->setopt(CURLOPT_SSL_VERIFYPEER, FALSE);
$curl->get('https://encrypted.example.com/');
```

```
Curl::put('http://api.example.com/user/', array(
    'first_name' => 'Zach',
    'last_name' => 'Borboa',
));
```

```
Curl::patch('http://api.example.com/profile/', array(
    'image' => '@path/to/file.jpg',
));
```

```
Curl::delete('http://api.example.com/user/', array(
    'id' => '1234',
));
```

```
$curl->close();
```

\###The Response Object###

The `$response` variable in above examples represents an object as well.

```
// Return cURL and http status (bool)
$response->error

// Return cURL error or http error code
$response->error_code

// cURL error or http error message
$response->error_message

// curl error (bool)
$response->curl_error

// curl error code
$response->curl_error_code

// curl error message
$response->curl_error_message

// http error  (bool)
$response->http_error

// Response http status code
$response->http_status_code

// Response http error message
$response->http_error_message

// Request _cookies
$response->_cookies

// set _headers
$response->_headers

// Request request_headers
$response->request_headers

// Return Headers
$response->response_headers

// cURL Info
$response->info

// Response Body
$response->body
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9677640?v=4)[zjango](/maintainers/zjango)[@zjango](https://github.com/zjango)

---

Top Contributors

[![zjango](https://avatars.githubusercontent.com/u/9677640?v=4)](https://github.com/zjango "zjango (2 commits)")

### Embed Badge

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

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

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

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

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

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

Router subcomponent for Mezzio

265.4M85](/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)
