PHPackages                             cleantalk/http - 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. cleantalk/http

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

cleantalk/http
==============

CleanTalk HTTP Requests library

1.1.0(1mo ago)07443GPL-3.0-or-laterPHP

Since Oct 19Pushed 1mo ago2 watchersCompare

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

READMEChangelogDependencies (1)Versions (4)Used By (3)

[![CleanTalk](https://camo.githubusercontent.com/8236aa569e5a5f1a4a8d3795f591c1ab76c1621b99730645cf68d91be502ea0a/68747470733a2f2f70732e772e6f72672f636c65616e74616c6b2d7370616d2d70726f746563742f6173736574732f69636f6e2d323536783235362e706e67)](https://cleantalk.org)

Cleantalk HTTP Requests
=======================

[](#cleantalk-http-requests)

Standalone PHP HTTP Request library

### Description

[](#description)

This standalone library allowing you to use different HTTP-requests in easy way. It could be simply merged into your project. Please, see "Usage" to learn more.

### Features

[](#features)

- POST, GET HTTP-methods.
- Multiple requests.
- Asynchronous requests.
- Callback functions.
- CURL options support.
- Any combination of the above features.

### Usage

[](#usage)

Download and include the file into your project by using PSR-0 (autoload) or directly attaching the files with "include" instruction. Use the following code to use the Request:

```
$request = new Cleantalk\Common\HTTP\Request();
$request_result = $request
    ->setUrl('example.com')
    ->setData(['foo' => 'bar']])
    ->setPresets(['async', 'ssl']))
    ->request();

```

You can reuse once created object change it URL and callback functions any time:

```
$another_request_result = $request
    ->setUrl($new_url)
    ->setCallback(
        function ($response_content, $requested_url){
            $processed_response_content = strreplace(
                'Hello',
                'Hey!',
                $response_content
            );

            return $processed_response_content;
        })
    ->request();

```

Or use a multiple async requests. This one will send asynchronous requests to example.com and exapme2.com wth custom user-agent and pass the response direct to the output buffer:

```
$miltiple_request = new Cleantalk\Common\HTTP\Request();
$multiple_request_result = $request
    ->setUrl(['example.com', 'example2.com'])
    ->setData(['foo' => 'bar']])
    ->setPresets(['async']))
    ->setOptions([
        CURLOPT_RETURNTRANSFER => fase,                  // CURL format is supported
        'user-agent'           => 'My custom User-Agent' // And user-friendly
        ])
    ->request();

```

Presets
-------

[](#presets)

The lib is using presets which allow you to configure its behaviour. Use 'setPresets()' method to set them.

```
->setPresets([
        'async',
        'get',
        'dont_follow_redirects'
    ])

```

May use the following presets (you can combine them in any way you want):

- dont\_follow\_redirects - ignore 300-family response code and don't follow redirects
- get\_code - getting only HTTP response code
- async - async requests. Sends request and return 'true' value. Doesn't wait for response.
- get - makes GET-type request instead of default POST-type
- ssl - uses SSL
- cache - allow caching for this request
- retry\_with\_socket - make another request with socket if cURL failed to retrieve data

Options
-------

[](#options)

If you need to precise tune you could use 'setOptions' method:

```
->setOptions([
        CURLOPT_RETURNTRANSFER => fase,                  // CURL format is supported
        'user-agent'           => 'My custom User-Agent' // And user-friendly
    ])

```

It supports any cURL type options(learn more in [cURL documentation](https://www.php.net/curl_setopt)) and the following human-friendly:

- timeout - maximum connection duration(int)
- sslverify - verify host (bool)
- sslcertificates - pass your own SSL certificate (string)
- headers - any custom headers (array of strings)
- user-agent - custom user-agent (string)

License
-------

[](#license)

This library is open-sourced software licensed under the [GPLv3 license](http://www.gnu.org/licenses/gpl-3.0.html).

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance89

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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 ~624 days

Total

3

Last Release

58d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/00cabd14ad0a24b6614de589e72519ff4433864097687217e62c2d80a10338ee?d=identicon)[CleanTalk](/maintainers/CleanTalk)

---

Top Contributors

[![Glomberg](https://avatars.githubusercontent.com/u/8588152?v=4)](https://github.com/Glomberg "Glomberg (5 commits)")[![safronik](https://avatars.githubusercontent.com/u/16255344?v=4)](https://github.com/safronik "safronik (1 commits)")[![svfcode](https://avatars.githubusercontent.com/u/74239490?v=4)](https://github.com/svfcode "svfcode (1 commits)")

### Embed Badge

![Health badge](/badges/cleantalk-http/health.svg)

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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