PHPackages                             juliangut/spiral - 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. juliangut/spiral

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

juliangut/spiral
================

A PSR7 aware cURL client

0.4(9y ago)315.1k3[1 issues](https://github.com/juliangut/spiral/issues)BSD-3-ClausePHPPHP ^5.5|^7.0

Since Oct 29Pushed 9y ago2 watchersCompare

[ Source](https://github.com/juliangut/spiral)[ Packagist](https://packagist.org/packages/juliangut/spiral)[ Docs](http://github.com/juliangut/spiral)[ RSS](/packages/juliangut-spiral/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (9)Versions (6)Used By (0)

[![PHP version](https://camo.githubusercontent.com/8c508dbfb530cc5703d088796f65f3230e83d32a68e84c73bc9e7847b12a0fa7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344352e352d3838393242462e7376673f7374796c653d666c61742d737175617265)](http://php.net)[![Latest Version](https://camo.githubusercontent.com/15774fc10f7d0cd25fbe973f439d3dfbfeea7d86aeae75066230c3055517aee5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f6a756c69616e6775742f73706972616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliangut/spiral)[![License](https://camo.githubusercontent.com/399ba7050dad6862fed0dbb931b8bd703711ef7e09ec04f96bd1df1eaf8d1a7f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a756c69616e6775742f73706972616c2e7376673f7374796c653d666c61742d737175617265)](https://github.com//spiral/blob/master/LICENSE)

[![Build Status](https://camo.githubusercontent.com/9a236462659297fda7093e2c0627e8ab1aa3e49258c83155c3bc7f4630b32ca5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a756c69616e6775742f73706972616c2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/juliangut/spiral)[![Style Check](https://camo.githubusercontent.com/e6891f9f7f191eb80b0f01f635464f364d826cf1d396a3e804d49981884660ef/68747470733a2f2f7374796c6563692e696f2f7265706f732f34353134383630362f736869656c64)](https://styleci.io/repos/45148606)[![Code Quality](https://camo.githubusercontent.com/38a9e14ecc97b8ec7d32eb67bb4c3068a4d25d3ab7d868ba960f671d8948aaf0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6a756c69616e6775742f73706972616c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/juliangut/spiral)[![Code Coverage](https://camo.githubusercontent.com/550e86fe3d9567f53e983a2ba054ba5e041b88517ba47d8ac056942aee2564ee/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a756c69616e6775742f73706972616c2e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/juliangut/spiral)

[![Total Downloads](https://camo.githubusercontent.com/bf9a48daa9c1e562f4f561bd6505e36bfcdfdff3d007a394cf67a95bc06f44ba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a756c69616e6775742f73706972616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliangut/spiral)[![Monthly Downloads](https://camo.githubusercontent.com/40daf1db920b2f355fe22c4ed8e79846215ddd681c38125efc7ab763e91ed5e7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6a756c69616e6775742f73706972616c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/juliangut/spiral)

PSR7 aware cURL client
======================

[](#psr7-aware-curl-client)

PSR7 compatible cURL client.

Use PSR7 Request and Response objects to perform HTTP Requests with cURL.

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

[](#installation)

Best way to install is using [Composer](https://getcomposer.org/):

```
composer require juliangut/spiral

```

Then require\_once the autoload file:

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

Usage
-----

[](#usage)

```
use Jgut\Spiral\Client;

// Create Spiral cURL client
$spiralClient = new Client;

// Create \Psr\Http\Message\RequestInterface request and configure it
$request = new PSR7RequestImplementation();

// Perform the request providing an empty \Psr\Http\Message\ResponseInterface response object to be populated
$response = $spiralClient->request($request, new PSR7ResponseImplementation());

// Use response
$headers = $response->getHeaders();
$content = (string) $response->getBody();
```

Transport
---------

[](#transport)

You can create an empty cURL transport object and set options on it later

```
$transport = new Curl;

$spiralClient = new Client($transport);
```

Or you can create the transport object from sane defaults

```
$transport = Curl::createFromDefaults();

$spiralClient = new Client($transport);
```

If no transport object is provided to `Jgut\Spiral\Client` constructor method one will be created by `Jgut\Spiral\Transport\Curl::createFromDefaults`

Options
-------

[](#options)

Transport object accepts cURL options

```
use Jgut\Spiral\Transport\Curl;
use Jgut\Spiral\Option\ConnectTimeout;

// Create Spiral cURL client
$transport = new Curl;

// Set option explicitly
$transport->setOption(new ConnectTimeout(10));

// Set by cURL constant
$transport->setOption(CURLOPT_CONNECTTIMEOUT, 10);

// Set using an alias
$transport->setOption('connect_timeout', 10);
```

### Reserved options

[](#reserved-options)

Some options are reserved and cannot be added to transport object using `setOption` method. Some of them are set by extracting the relevant data from request oobject.

The following is a list of options automatically handled by the transport object

- `CURLOPT_NOBODY`
- `CURLOPT_HTTPGET`
- `CURLOPT_POST`
- `CURLOPT_CUSTOMREQUEST`
- `CURLOPT_URL`
- `CURLOPT_POSTFIELDS`
- `CURLOPT_HTTPHEADER`

### Available options

[](#available-options)

Option classAliascURL constantValue typeAutoRefererauto\_refererCURLOPT\_AUTOREFERERboolConnectTimeoutconnect\_timeoutCURLOPT\_CONNECTTIMEOUTintCookiecookieCURLOPT\_COOKIEstringCookieFilecookie\_fileCURLOPT\_COOKIEFILEstringCookieJarcookie\_jarCURLOPT\_COOKIEJARstringCrlfcrlfCURLOPT\_CRLFboolEncodingencodingCURLOPT\_ENCODINGstringFileTimefile\_timeCURLOPT\_FILETIMEboolFollowLocationfollow\_locationCURLOPT\_FOLLOWLOCATIONboolHeaderheaderCURLOPT\_HEADERboolHeaderOutheader\_outCURLINFO\_HEADER\_OUTboolHttpAuthhttp\_authCURLOPT\_HTTPAUTHboolHttpVersionhttp\_versionCURLOPT\_HTTP\_VERSIONfloat (1.0 or 1.1)MaxRedirsmax\_redirsCURLOPT\_MAXREDIRSintPortportCURLOPT\_PORTintRefererrefererCURLOPT\_REFERERstringReturnTransferreturn\_transferCURLOPT\_RETURNTRANSFERboolSslVerifyPeerssl\_verify\_peerCURLOPT\_SSL\_VERIFYPEERboolSslVersionssl\_versionCURLOPT\_SSLVERSIONintTimeouttimeoutCURLOPT\_TIMEOUTintUnrestrictedAuthunrestricted\_authCURLOPT\_UNRESTRICTED\_AUTHboolUserAgentuser\_agentCURLOPT\_USERAGENTstringUserPwduser\_passwordCURLOPT\_USERPWDstring (user:password)VerboseverboseCURLOPT\_VERBOSEbool*Review Jgut\\Spiral\\Option\\OptionFactory for a full list of available aliases*

Contributing
------------

[](#contributing)

Found a bug or have a feature request? [Please open a new issue](https://github.com/juliangut/spiral/blob/master/issues). Have a look at existing issues before

See file [CONTRIBUTING.md](https://github.com/juliangut/spiral/blob/master/CONTRIBUTING.md)

License
-------

[](#license)

### Release under BSD-3-Clause License.

[](#release-under-bsd-3-clause-license)

See file [LICENSE](https://github.com/juliangut/spiral/blob/master/LICENSE) included with the source code for a copy of the license terms

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.2% 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 ~146 days

Total

5

Last Release

3318d ago

PHP version history (2 changes)0.1PHP &gt;=5.5

0.3PHP ^5.5|^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c50421f1ab4148354dc2dd5dcaba168656b17ea913b310d112deb39a6f73ca1?d=identicon)[juliangut](/maintainers/juliangut)

---

Top Contributors

[![juliangut](https://avatars.githubusercontent.com/u/1104131?v=4)](https://github.com/juliangut "juliangut (57 commits)")[![trendfischer](https://avatars.githubusercontent.com/u/861121?v=4)](https://github.com/trendfischer "trendfischer (11 commits)")[![dezzak](https://avatars.githubusercontent.com/u/3330604?v=4)](https://github.com/dezzak "dezzak (4 commits)")

---

Tags

curlpsr-7responserequestcurlpsr7

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/juliangut-spiral/health.svg)

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B4.0k](/packages/guzzlehttp-psr7)[aplus/http-client

Aplus Framework HTTP Client Library

2171.6M1](/packages/aplus-http-client)[contributte/psr7-http-message

PSR-7 (HTTP Message Interface) to Nette Framework

233.0M10](/packages/contributte-psr7-http-message)[pdeans/http

PSR-7 cURL HTTP client with support for PSR-17 HTTP factories.

1466.5k3](/packages/pdeans-http)[chadicus/slim-oauth2-http

Bridge components for PSR-7 and bshaffer's OAuth2 Server http messages.

18466.2k7](/packages/chadicus-slim-oauth2-http)[sunrise/http-message

An HTTP message implementation based on PSR-7, PSR-17 and RFC-7230.

18114.6k17](/packages/sunrise-http-message)

PHPackages © 2026

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