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

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

guinso/hx-http
==============

HTTP input and output handler

2.0(10y ago)1521MITPHPPHP &gt;=5.6

Since Dec 13Pushed 10y ago1 watchersCompare

[ Source](https://github.com/guinso/hx-http)[ Packagist](https://packagist.org/packages/guinso/hx-http)[ RSS](/packages/guinso-hx-http/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (7)DependenciesVersions (8)Used By (1)

hx-http
=======

[](#hx-http)

PHP Http input and output handler

Install
-------

[](#install)

- **Composer**

```
    //for PHP 5.5
    {
        "require": {
            "guinso/hx-http": "1.0.*"
        }
    }

    //for PHP 7
    {
        "require": {
            "guinso/hx-http": "2.0.*"
        }
    }
```

- **Manual**

```
    require_once('path-of-hx-http-library/src/autoloader.php');
```

Example
-------

[](#example)

- **Read Http Input**

```
$httpHeader = new \Hx\Http\HeaderReader();
$httpInputService = new \Hx\Http\InputService();
$arrInfo = $httpInputService.getInput($httpHeader);

//to read general input (no matter GET, POST, or PUT)
$yourClientDataValue = $arrInfo['data']['your-client-specified-data-key'];

//to read client uploaded file path (work for multipart format as well)
$clientUploadTemporaryFilePath = $arrInfo['file']['your-client-specified-file-name'];
```

- **Write Http Output**
    - JSON or XML

    ```
    $outputService = new \Hx\Http\OutputService();
    $outputData = array(
      'key-A' => 123,
      'key-B' => 'Cat meow',
      'key-C' => [
        'sub-key-1' => 157.67,
        'sub-key-2' => "tree"
      ]
    );

    //generate JSON output to http
    $outputService->generateOutput('json', $outputData);
    //OR generate in XML format
    $outputService->generateOutput('xml', $outputData);
    ```

    - Html

    ```
    $outputService = new \Hx\Http\OutputService();
    $htmlOutput = array(
      'header' =>  //this is html header tag
        "Page Title
        ",
      'body' => //this is html body tag
       "
        ...
       "
    );

    //generate Html output format
    $outputService->generateOutput('html', $htmlOutput);
    ```

    - Download file to client

    ```
    $outputService = new \Hx\Http\OutputService();

    $fileInfo = array(
      'fileName' => 'filename-which-you-want-show-to-client',
      'filePath' => 'actual-physical-file-path'
    );

    //download file to client (client never know physical file location)
    $outputService->generateOutput('file', $fileInfo);
    ```

    - Plain text format

    ```
    $outputService = new \Hx\Http\OutputService();

    $data = array("data" => "anything....");

    //generate plain text to client
    //NOTE: output is not in Html format since it is marked as 'text/plain' MIME type
    $outputService->generateOutput('text', $data);
    ```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

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

Recently: every ~50 days

Total

7

Last Release

3650d ago

Major Versions

1.0.5 → 2.02016-07-02

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1818236?v=4)[Benjamin Ching](/maintainers/guinso)[@guinso](https://github.com/guinso)

---

Top Contributors

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

---

Tags

http

### Embed Badge

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

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.1B3.8k](/packages/guzzlehttp-psr7)[psr/http-message

Common interface for HTTP messages

7.0k1.1B6.5k](/packages/psr-http-message)[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k728.6M2.5k](/packages/psr-http-factory)[php-http/httplug

HTTPlug, the HTTP client abstraction for PHP

2.6k319.6M739](/packages/php-http-httplug)[psr/http-client

Common interface for HTTP clients

1.7k714.1M2.7k](/packages/psr-http-client)[symfony/http-client

Provides powerful methods to fetch HTTP resources synchronously or asynchronously

2.0k330.1M4.6k](/packages/symfony-http-client)

PHPackages © 2026

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