PHPackages                             vpsfreecz/httpful - 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. vpsfreecz/httpful

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

vpsfreecz/httpful
=================

A Readable, Chainable, REST friendly, PHP HTTP Client

0.4.0(3y ago)0388—0%1MITPHPPHP &gt;=7.2

Since Apr 14Pushed 3y agoCompare

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

READMEChangelogDependencies (1)Versions (26)Used By (1)

Httpful
=======

[](#httpful)

This is a fork of [nategood/httpful](https://github.com/nategood/httpful) to support newer PHP versions for use in [HaveAPI](https://github.com/vpsfreecz/haveapi). Maintenance only.

Httpful is a simple Http Client library for PHP 7.2+. There is an emphasis of readability, simplicity, and flexibility – basically provide the features and flexibility to get the job done and make those features really easy to use.

Features

- Readable HTTP Method Support (GET, PUT, POST, DELETE, HEAD, PATCH and OPTIONS)
- Custom Headers
- Automatic "Smart" Parsing
- Automatic Payload Serialization
- Basic Auth
- Client Side Certificate Auth
- Request "Templates"

Sneak Peak
==========

[](#sneak-peak)

Here's something to whet your appetite. Search the twitter API for tweets containing "#PHP". Include a trivial header for the heck of it. Notice that the library automatically interprets the response as JSON (can override this if desired) and parses it as an array of objects.

```
// Make a request to the GitHub API with a custom
// header of "X-Trvial-Header: Just as a demo".
$url = "https://api.github.com/users/nategood";
$response = \Httpful\Request::get($url)
    ->expectsJson()
    ->withXTrivialHeader('Just as a demo')
    ->send();

echo "{$response->body->name} joined GitHub on " .
                        date('M jS', strtotime($response->body->created_at)) ."\n";
```

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

[](#installation)

Composer
--------

[](#composer)

Httpful is PSR-0 compliant and can be installed using [composer](http://getcomposer.org/). Simply add `vpsfreecz/httpful` to your composer.json file. *Composer is the sane alternative to PEAR. It is excellent for managing dependencies in larger projects*.

```
{
    "require": {
        "vpsfreecz/httpful": "*"
    }
}

```

Install from Source
-------------------

[](#install-from-source)

Because Httpful is PSR-0 compliant, you can also just clone the Httpful repository and use a PSR-0 compatible autoloader to load the library, like [Symfony's](http://symfony.com/doc/current/components/class_loader.html). Alternatively you can use the PSR-0 compliant autoloader included with the Httpful (simply `require("bootstrap.php")`).

Build your Phar
---------------

[](#build-your-phar)

If you want the build your own [Phar Archive](http://php.net/manual/en/book.phar.php) you can use the `build` script included. Make sure that your `php.ini` has the *Off* or 0 value for the `phar.readonly` setting. Also you need to create an empty `downloads` directory in the project root.

Contributing
============

[](#contributing)

Httpful highly encourages sending in pull requests. When submitting a pull request please:

- All pull requests should target the `dev` branch (not `master`)
- Make sure your code follows the [coding conventions](http://pear.php.net/manual/en/standards.php)
- Please use soft tabs (four spaces) instead of hard tabs
- Make sure you add appropriate test coverage for your changes
- Run all unit tests in the test directory via `phpunit ./tests`
- Include commenting where appropriate and add a descriptive pull request message

Changelog
=========

[](#changelog)

0.4.0
-----

[](#040)

- Compatibility with PHP 8.1

0.3.2
-----

[](#032)

- REFACTOR [PR #276](https://github.com/nategood/httpful/pull/276) Add properly subclassed, more descriptive Exceptions for JSON parse errors

0.3.1
-----

[](#031)

- FIX [PR #286](https://github.com/nategood/httpful/pull/286) Fixed header case sensitivity

0.3.0
-----

[](#030)

- REFACTOR Dropped support for dead versions of PHP. Updated the PHPUnit tests.

0.2.20
------

[](#0220)

- MINOR Move Response building logic into separate function [PR #193](https://github.com/nategood/httpful/pull/193)

0.2.19
------

[](#0219)

- FEATURE Before send hook [PR #164](https://github.com/nategood/httpful/pull/164)
- MINOR More descriptive connection exceptions [PR #166](https://github.com/nategood/httpful/pull/166)

0.2.18
------

[](#0218)

- FIX [PR #149](https://github.com/nategood/httpful/pull/149)
- FIX [PR #150](https://github.com/nategood/httpful/pull/150)
- FIX [PR #156](https://github.com/nategood/httpful/pull/156)

0.2.17
------

[](#0217)

- FEATURE [PR #144](https://github.com/nategood/httpful/pull/144) Adds additional parameter to the Response class to specify additional meta data about the request/response (e.g. number of redirect).

0.2.16
------

[](#0216)

- FEATURE Added support for whenError to define a custom callback to be fired upon error. Useful for logging or overriding the default error\_log behavior.

0.2.15
------

[](#0215)

- FEATURE [I #131](https://github.com/nategood/httpful/pull/131) Support for SOCKS proxy

0.2.14
------

[](#0214)

- FEATURE [I #138](https://github.com/nategood/httpful/pull/138) Added alternative option for XML request construction. In the next major release this will likely supplant the older version.

0.2.13
------

[](#0213)

- REFACTOR [I #121](https://github.com/nategood/httpful/pull/121) Throw more descriptive exception on curl errors
- REFACTOR [I #122](https://github.com/nategood/httpful/issues/122) Better proxy scrubbing in Request
- REFACTOR [I #119](https://github.com/nategood/httpful/issues/119) Better document the mimeType param on Request::body
- Misc code and test cleanup

0.2.12
------

[](#0212)

- REFACTOR [I #123](https://github.com/nategood/httpful/pull/123) Support new curl file upload method
- FEATURE [I #118](https://github.com/nategood/httpful/pull/118) 5.4 HTTP Test Server
- FIX [I #109](https://github.com/nategood/httpful/pull/109) Typo
- FIX [I #103](https://github.com/nategood/httpful/pull/103) Handle also CURLOPT\_SSL\_VERIFYHOST for strictSsl mode

0.2.11
------

[](#0211)

- FIX [I #99](https://github.com/nategood/httpful/pull/99) Prevent hanging on HEAD requests

0.2.10
------

[](#0210)

- FIX [I #93](https://github.com/nategood/httpful/pull/86) Fixes edge case where content-length would be set incorrectly

0.2.9
-----

[](#029)

- FEATURE [I #89](https://github.com/nategood/httpful/pull/89) multipart/form-data support (a.k.a. file uploads)! Thanks @dtelaroli!

0.2.8
-----

[](#028)

- FIX Notice fix for Pull Request 86

0.2.7
-----

[](#027)

- FIX [I #86](https://github.com/nategood/httpful/pull/86) Remove Connection Established header when using a proxy

0.2.6
-----

[](#026)

- FIX [I #85](https://github.com/nategood/httpful/issues/85) Empty Content Length issue resolved

0.2.5
-----

[](#025)

- FEATURE [I #80](https://github.com/nategood/httpful/issues/80) [I #81](https://github.com/nategood/httpful/issues/81) Proxy support added with `useProxy` method.

0.2.4
-----

[](#024)

- FEATURE [I #77](https://github.com/nategood/httpful/issues/77) Convenience method for setting a timeout (seconds) `$req->timeoutIn(10);`
- FIX [I #75](https://github.com/nategood/httpful/issues/75) [I #78](https://github.com/nategood/httpful/issues/78) Bug with checking if digest auth is being used.

0.2.3
-----

[](#023)

- FIX Overriding default Mime Handlers
- FIX [PR #73](https://github.com/nategood/httpful/pull/73) Parsing http status codes

0.2.2
-----

[](#022)

- FEATURE Add support for parsing JSON responses as associative arrays instead of objects
- FEATURE Better support for setting constructor arguments on Mime Handlers

0.2.1
-----

[](#021)

- FEATURE [PR #72](https://github.com/nategood/httpful/pull/72) Allow support for custom Accept header

0.2.0
-----

[](#020)

- REFACTOR [PR #49](https://github.com/nategood/httpful/pull/49) Broke headers out into their own class
- REFACTOR [PR #54](https://github.com/nategood/httpful/pull/54) Added more specific Exceptions
- FIX [PR #58](https://github.com/nategood/httpful/pull/58) Fixes throwing an error on an empty xml response
- FEATURE [PR #57](https://github.com/nategood/httpful/pull/57) Adds support for digest authentication

0.1.6
-----

[](#016)

- Ability to set the number of max redirects via overloading `followRedirects(int max_redirects)`
- Standards Compliant fix to `Accepts` header
- Bug fix for bootstrap process when installed via Composer

0.1.5
-----

[](#015)

- Use `DIRECTORY_SEPARATOR` constant [PR #33](https://github.com/nategood/httpful/pull/32)
- [PR #35](https://github.com/nategood/httpful/pull/35)
- Added the raw\_headers property reference to response.
- Compose request header and added raw\_header to Request object.
- Fixed response has errors and added more comments for clarity.
- Fixed header parsing to allow the minimum (status line only) and also cater for the actual CRLF ended headers as per RFC2616.
- Added the perfect test Accept: header for all Acceptable scenarios see @b78e9e82cd9614fbe137c01bde9439c4e16ca323 for details.
- Added default User-Agent header
- `User-Agent: Httpful/0.1.5` + curl version + server software + PHP version
- To bypass this "default" operation simply add a User-Agent to the request headers even a blank User-Agent is sufficient and more than simple enough to produce me thinks.
- Completed test units for additions.
- Added phpunit coverage reporting and helped phpunit auto locate the tests a bit easier.

0.1.4
-----

[](#014)

- Add support for CSV Handling [PR #32](https://github.com/nategood/httpful/pull/32)

0.1.3
-----

[](#013)

- Handle empty responses in JsonParser and XmlParser

0.1.2
-----

[](#012)

- Added support for setting XMLHandler configuration options
- Added examples for overriding XmlHandler and registering a custom parser
- Removed the httpful.php download (deprecated in favor of httpful.phar)

0.1.1
-----

[](#011)

- Bug fix serialization default case and phpunit tests

0.1.0
-----

[](#010)

- Added Support for Registering Mime Handlers
- Created AbstractMimeHandler type that all Mime Handlers must extend
- Pulled out the parsing/serializing logic from the Request/Response classes into their own MimeHandler classes
- Added ability to register new mime handlers for mime types

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~161 days

Recently: every ~707 days

Total

25

Last Release

1252d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3

0.3.0PHP &gt;=7.2

### Community

Maintainers

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

---

Top Contributors

[![nategood](https://avatars.githubusercontent.com/u/154115?v=4)](https://github.com/nategood "nategood (55 commits)")[![nickl-](https://avatars.githubusercontent.com/u/1404606?v=4)](https://github.com/nickl- "nickl- (13 commits)")[![josch1710](https://avatars.githubusercontent.com/u/1742593?v=4)](https://github.com/josch1710 "josch1710 (8 commits)")[![zdouglas](https://avatars.githubusercontent.com/u/6619887?v=4)](https://github.com/zdouglas "zdouglas (7 commits)")[![bpedro](https://avatars.githubusercontent.com/u/56472?v=4)](https://github.com/bpedro "bpedro (7 commits)")[![cviebrock](https://avatars.githubusercontent.com/u/166810?v=4)](https://github.com/cviebrock "cviebrock (5 commits)")[![mishak87](https://avatars.githubusercontent.com/u/276500?v=4)](https://github.com/mishak87 "mishak87 (5 commits)")[![stewsnooze](https://avatars.githubusercontent.com/u/196643?v=4)](https://github.com/stewsnooze "stewsnooze (4 commits)")[![aonic](https://avatars.githubusercontent.com/u/249801?v=4)](https://github.com/aonic "aonic (4 commits)")[![dtelaroli](https://avatars.githubusercontent.com/u/536500?v=4)](https://github.com/dtelaroli "dtelaroli (4 commits)")[![aither64](https://avatars.githubusercontent.com/u/4717906?v=4)](https://github.com/aither64 "aither64 (3 commits)")[![andrzejd-pl](https://avatars.githubusercontent.com/u/25104566?v=4)](https://github.com/andrzejd-pl "andrzejd-pl (3 commits)")[![atymic](https://avatars.githubusercontent.com/u/50683531?v=4)](https://github.com/atymic "atymic (3 commits)")[![livkiss](https://avatars.githubusercontent.com/u/256075?v=4)](https://github.com/livkiss "livkiss (3 commits)")[![ramiel](https://avatars.githubusercontent.com/u/324687?v=4)](https://github.com/ramiel "ramiel (3 commits)")[![hello-josh](https://avatars.githubusercontent.com/u/638073?v=4)](https://github.com/hello-josh "hello-josh (2 commits)")[![luads](https://avatars.githubusercontent.com/u/194708?v=4)](https://github.com/luads "luads (2 commits)")[![quafzi](https://avatars.githubusercontent.com/u/164261?v=4)](https://github.com/quafzi "quafzi (2 commits)")[![LeviticusMB](https://avatars.githubusercontent.com/u/1094822?v=4)](https://github.com/LeviticusMB "LeviticusMB (2 commits)")[![Artistan](https://avatars.githubusercontent.com/u/801349?v=4)](https://github.com/Artistan "Artistan (2 commits)")

---

Tags

httpapirestcurlrestfulrequests

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vpsfreecz-httpful/health.svg)

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

###  Alternatives

[nategood/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

1.8k17.2M266](/packages/nategood-httpful)[voku/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

16183.9k1](/packages/voku-httpful)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)[msankhala/parsehub-php

Php wrapper classes for Parsehub REST api.

1312.4k](/packages/msankhala-parsehub-php)[wellrested/wellrested

Simple PHP Library for RESTful APIs

4818.7k4](/packages/wellrested-wellrested)

PHPackages © 2026

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