PHPackages                             fightbulc/php\_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. fightbulc/php\_curl

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

fightbulc/php\_curl
===================

PHP CURL as object-oriented implementation.

1.0.0(13y ago)274.5k7GPL-3.0PHPPHP &gt;=5.3.3

Since Oct 22Pushed 13y agoCompare

[ Source](https://github.com/fightbulc/php_curl)[ Packagist](https://packagist.org/packages/fightbulc/php_curl)[ Docs](https://github.com/fightbulc/php_curl)[ RSS](/packages/fightbulc-php-curl/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (7)

PHP\_CURL
=========

[](#php_curl)

PHP\_CURL is an object-oriented implementation of the PHP's functional CURL interface.

Basic Usage
-----------

[](#basic-usage)

Since PHP\_CURL allows for method-chaining, the static `init` method is used to generate an instance of a CURL object (similar to `curl_init`).

```

```

We can then set some CURL options:

```

```

All `set...` functions return an instance of the current CURL object, so you are free to set as many of the options in a row as necessary before executing.

```

```

All of the functions are close matches to the CURLOPT\_\* alternatives.

Comparison to functional cURL
-----------------------------

[](#comparison-to-functional-curl)

The basic example given in the PHP manual for functional cURL is as follows:

```

```

We can perform the same operation with PHP\_CURL like so:

```

```

There isn't much of a difference in terms of code-size or performance, however, the PHP\_CURL approach is arguably more readible, and less repeatitive.

One major benefit to using this approach is that it enables us to take advantage of PHP editors with auto-completion, so setting multiple cURL options should be somewhat easier.

Issues
------

[](#issues)

At present, there is no support for `curl_multi...`. Support for `curl_multi...`is coming soon.

Why do this?
------------

[](#why-do-this)

I found that writing for CURL in PHP was repeatitive and cumbersome, and having a quick, object-oriented and more readable way of performing quick CURL tasks was something I've wanted for a while.

I don't claim to have done anything special here, nor do I propose that this should be used in any sort of production environment. It's quick and dirty, but it's working for me.

I strongly encoruage any sort of feedback, patches or contributions. I'd be more than happy to open up this project to more developers if there is any demand.

FAQ
---

[](#faq)

**Q. Why `CURL::init()` instead of `new CURL()`?**

A. If you want to take advantage of method-chaining, use `CURL::init`, since PHP's constructors don't allow for things like `(new Curl())->foo()`.

However, if you prefer to instanciate an object and then use that object, support for `$foo = new CURL()` is allowed. Both will work.

**Q. Couldn't you have just done this with a single `__call()` wrapper, or use `__get()` and `__set()`?**

This is true, however, a design decision was made to expand all the possible functions to `get...` and `set...` functions individually. This means that it's easier for a newcomer to the code to see clearly what methods are available. Not to mention that editors with auto-completion ability aren't often clever enough to discover magic method handling.

At the end of the day, whether it's handled using PHPDoc paramters and magic methods, or all methods are out there in plain sight, it doesn't make a difference either way, and I feel that if all methods are in plain sight, then there is little to no confusion as to what methods are available.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

5003d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/451061?v=4)[Tino Ehrich](/maintainers/fightbulc)[@fightbulc](https://github.com/fightbulc)

---

Top Contributors

[![BauerUK](https://avatars.githubusercontent.com/u/149427?v=4)](https://github.com/BauerUK "BauerUK (10 commits)")[![FractalizeR](https://avatars.githubusercontent.com/u/318489?v=4)](https://github.com/FractalizeR "FractalizeR (7 commits)")

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/fightbulc-php-curl/health.svg)](https://phpackages.com/packages/fightbulc-php-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.4M92](/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)
