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

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

spruce-bruce/curl
=================

v0.1.0(12y ago)012[1 issues](https://github.com/spruce-bruce/Curl.php/issues)MITPHP

Since Jul 11Pushed 12y ago1 watchersCompare

[ Source](https://github.com/spruce-bruce/Curl.php)[ Packagist](https://packagist.org/packages/spruce-bruce/curl)[ RSS](/packages/spruce-bruce-curl/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Curl.php
========

[](#curlphp)

This is a wrapper class for curl that I've developed as a Curl shorthand. There are other curl wrappers out there, but I was never really a fan of any of the ones I found.

In this class I implement static methods for the HTTP requests: get(), post(), delete(), and put().

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

[](#installation)

You can just download the zip of this repo (or clone it) and include the Curl.php file. If you like composer I've added this repo to packagist and you can install by adding `"spruce-bruce/composer" : "0.1.*"` to your requirements.

Usage
-----

[](#usage)

Here are some fictional examples that show the use of Curl.php.

### POST

[](#post)

Example POST:

```
//set the url
$url = "http://somefictionaldomain.com/api";

//set the POST vars
$data = array(
    'query' => 'active',
    'page' => 3,
    'count' => 10
);

//get the post response
$response = Curl::post($url, $data);
```

### GET

[](#get)

Example GET with additional curl options:

```
//set the url
$url = "http://somefictionaldomain.com/api";

//set the GET vars
$data = array(
    'query' => 'active',
    'page' => 3,
    'count' => 10
);

//set addtional curl options
$options = array(
    CURLOPT_FAILONERROR => true
);

//get the GET response
$response = Curl::get($url, $data, $options);
```

Default curl options
--------------------

[](#default-curl-options)

Each type of http request will have some default curl options set. Defaults cannot currently be changed. Defaults are determined by my experience using curl in the past, ie, they are the options that I will generally always set for a given HTTP request type.

### POST

[](#post-1)

- CURLOPT\_RETURNTRANSFER
- CURLOPT\_POST
- CURLOPT\_POSTFIELDS (only if the $data param is set)

### GET

[](#get-1)

- CURLOPT\_RETURNTRANSFER

### DELETE

[](#delete)

unimplemented

### PUT

[](#put)

unimplemented

TODO
----

[](#todo)

- Implemente delete() and put() methods
- Clean up HTTP code parsing and make it more robust (ie, add any messages in the response to the exception)
- Save and make response headers accessible
- Save and make curl resource accessible
- Document exceptions

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

4737d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/59978?v=4)[Aaron Bruce](/maintainers/spruce-bruce)[@spruce-bruce](https://github.com/spruce-bruce)

### Embed Badge

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

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/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

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

Router subcomponent for Mezzio

265.3M84](/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

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

PHPackages © 2026

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