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

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

sndsgd/http
===========

Improved HTTP for PHP

v1.0.0(6y ago)11.3k1[1 issues](https://github.com/sndsgd/http/issues)1MITPHPPHP &gt;=7.1.0

Since Nov 11Pushed 6y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (9)Versions (13)Used By (1)

sndsgd/http
===========

[](#sndsgdhttp)

[![Latest Version](https://camo.githubusercontent.com/dfe3b268e74a7cc3f1c1a3453cd809688a9eeabf217ed3871218e7a5c3129d8c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f736e647367642f687474702e7376673f7374796c653d666c61742d737175617265)](https://github.com/sndsgd/http/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/sndsgd/http/LICENSE)[![Build Status](https://camo.githubusercontent.com/093cce9df9176f531370bba2bda8ae9b873984082f2c67863fbe81b5311d694c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f736e647367642f687474702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/sndsgd/http)[![Coverage Status](https://camo.githubusercontent.com/39b848ab1cdd6b020ccc38bbf9da38f31dccbac52b8b05e69311790c4b23a164/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f736e647367642f687474702e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/sndsgd/http?branch=master)[![Total Downloads](https://camo.githubusercontent.com/5982bf727d835a25204453938a2d4e43136fb782d632c4b699777f125f36ddaf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736e647367642f687474702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sndsgd/http)

Improved HTTP for PHP.

Requirements
------------

[](#requirements)

You need **PHP &gt;= 7.1** to use this library, however, the latest stable version of PHP is recommended.

Install
-------

[](#install)

Install `sndsgd/http` using [Composer](https://getcomposer.org/).

Usage
-----

[](#usage)

This library aims to improve how PHP handles HTTP requests, mainly by streamlining the the process of working with request parameters.

### Improved Request Parameter Decoders

[](#improved-request-parameter-decoders)

To experiment with the decoders, you can use PHP's built in webserver with the script located in `bin/request-demo.php`.

```
php -S localhost:8000 bin/request-demo.php
```

Now you will be able to make requests to [http://localhost:8000](http://localhost:8000/) using any HTTP client. In the examples below, we'll be using [httpie](https://github.com/jkbrzt/httpie). To dump information about the request that is being made, simply append `-v` to any of the commands below.

#### Query String Decoder

[](#query-string-decoder)

In many query parameter implementations, you do not need to use brackets to indicate multiple values, but with PHP you do. For compatibility with the built in PHP decoder, you can continue to use brackets.

```
http http://localhost:8000/query a==1 a==2 a[]==💩
```

Result:

```
    "$_GET": {
        "a": [
            "💩"
        ]
    },
    "sndsgd": {
        "a": [
            "1",
            "2",
            "💩"
        ]
    }
}
```

#### Request Body Decoder

[](#request-body-decoder)

The built in body decoder for PHP only handles `multipart/form-data` and `application/x-www-form-urlencoded` content types for `POST` requests. This library acts as a polyfill to add `application/json` to that list, and to allow for decoding the request body for *any* request method. By default, `POST` requests will be processed by the built in PHP decoder, however, you can disable that functionality by setting `enable_post_data_reading = Off` in your `php.ini`.

> *The built in decoder will not decode the body of this urlencoded `PATCH` request*

```
http --form PATCH http://localhost:8000/body a=1 b=2 c[d]=3a

```

Result:

```
{
    "$_POST": [],
    "$_FILES": [],
    "sndsgd": {
        "a": "1",
        "b": "2",
        "c": {
            "d": "3"
        }
    }
}
```

#### Uploaded Files

[](#uploaded-files)

Instead of using `$_FILES`, with `sndsgd/http` uploaded files are included with the other parameters of the request body as objects.

```
http --form POST http://localhost:8000/body a=1 file@README.md

```

Result:

```
{
    "$_POST": {
        "a": "1"
    },
    "$_FILES": {
        "file": {
            "name": "README.md",
            "type": "",
            "tmp_name": "/private/var/folders/2b/mtmy5wk56jx13vjgqpydc3nr0000gn/T/php9DTXiq",
            "error": 0,
            "size": 2766
        }
    },
    "sndsgd": {
        "a": "1",
        "file": {
            "filename": "README.md",
            "contentType": "text/x-markdown",
            "realContentType": "text/plain",
            "size": 2766,
            "tempfile": "/private/var/folders/2b/mtmy5wk56jx13vjgqpydc3nr0000gn/T/php9DTXiq"
        }
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~156 days

Recently: every ~276 days

Total

12

Last Release

2475d ago

Major Versions

0.9.6 → v1.0.02019-07-30

PHP version history (4 changes)0.1.0PHP &gt;=5.5.0

0.1.1PHP &gt;=5.4.0

0.9.0PHP &gt;=7.0.0

v1.0.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d42821cbb8506a162e4d0566e5f1dae4c3b8d28b65afcaec39ce2607781f588a?d=identicon)[sndsgd](/maintainers/sndsgd)

---

Top Contributors

[![sndsgd](https://avatars.githubusercontent.com/u/5289973?v=4)](https://github.com/sndsgd "sndsgd (42 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

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

2.8k73.3M317](/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.8M292](/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)
