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

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

parable-php/http
================

Parable HTTP is a straight-forward Request/Response library

1.02(1y ago)25231MITPHPPHP &gt;=8.0

Since Mar 22Pushed 1y ago1 watchersCompare

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

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

Parable Http
============

[](#parable-http)

[![Workflow Status](https://github.com/parable-php/http/workflows/Tests/badge.svg)](https://github.com/parable-php/http/actions?query=workflow%3ATests)[![Latest Stable Version](https://camo.githubusercontent.com/a5f42c98fc359a10823e3fb5f3e79ff8cb46089e79238821fcf311e0dab07df8/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f687474702f762f737461626c65)](https://packagist.org/packages/parable-php/http)[![Latest Unstable Version](https://camo.githubusercontent.com/1b3d60cd70aafaf3da5839def74358f9f793e129801ee33b50c2ec55f3387595/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f687474702f762f756e737461626c65)](https://packagist.org/packages/parable-php/http)[![License](https://camo.githubusercontent.com/b5e3be18151435354eb94c299a91bf8ceb9750856abf1507aa2d6dad28f00151/68747470733a2f2f706f7365722e707567782e6f72672f70617261626c652d7068702f687474702f6c6963656e7365)](https://packagist.org/packages/parable-php/http)

Parable Http is a minimalist Http library used to receive requests and send responses. It is not a full implementation, offering just-enough functionality.

Install
-------

[](#install)

Php 8.0+ and [composer](https://getcomposer.org) are required.

```
$ composer require parable-php/http
```

Usage
-----

[](#usage)

To create a `Request` object automatically from the server variables, use:

```
$request = RequestFactory::createFromServer();
```

To create a `Request` from scratch, use:

```
$request = new Request(
    'GET',
    'http://url.here/path?param=value'
);
```

To set up a minimal response you want to send to the client:

```
$response = new Response(200, 'This is the body');
```

And to send it, use the `Dispatcher`:

```
$response = new Response(200, 'This is the body');
$dispatcher = new Dispatcher();

$dispatcher->dispatch($response);
```

This will send a response with stat us code `200`, with the body set as passed to the `Response` upon creation.

API
---

[](#api)

### Request

[](#request)

- `getMethod(): string` - returns GET, POST, etc.
- `getUri(): Uri` - return a `Uri` object representing the uri being requested
- `getRequestUri(): ?string` - the path of the `Uri`
- `getProtocol(): string` - the protocol used (i.e. `HTTP/1.1`)
- `getProtocolVersion(): string` - the version part of the protocol (i.e. `1.1`)
- `getBody(): ?string` - the body of the request, if any
- `getUser(): ?string` - the username from the uri
- `getPass(): ?string` - the password from the uri
- `isHttps(): bool` - whether the request was made over https. This represents a 'best guess' based on multiple checks
- `isMethod(string $method): bool` - check whether the method matches `$method`

From the `HasHeaders` trait:

- `getHeader(string $header): ?string` - get a single header by string, `null` if non-existing
- `getHeaders(): string[]` - get all headers

### Response

[](#response)

- `getBody(): ?string` - the body to be sent
- `setBody(string $body): void` - set the body as a string
- `prependBody(string $content): void` - prepend the value to the body
- `appendBody(string $content): void` - append the value to the body
- `getContentType(): string` - the content type (i.e. `text/html`, `application/json`)
- `setContentType(string $contentType): void` - set the content type
- `getProtocol(): string` - the protocol to be sent with (i.e. `HTTP/1.1`)
- `getProtocolVersion(): string` - the protocol version (i.e. `1.1`)
- `setProtocol(string $protocol): void` - set the protocol
- `setHeaders(array $headers): void` - set multiple headers, resetting
- `addHeaders(array $headers): void` - add multiple headers
- `addHeader(string $header, string $value): void` - add single header

From the `HasHeaders` trait:

- `getHeader(string $header): ?string` - get a single header by string, `null` if non-existing
- `getHeaders(): string[]` - get all headers

From the `HasStatusCode` trait:

- `getStatusCode(): int` - the status code to be sent (i.e. `200`)
- `getStatusCodeText(): ?string` - the status code text to be sent (i.e. `OK`)
- `setStatusCode(int $statusCode): void` - set the status code

### Dispatcher

[](#dispatcher)

- `dispatch(Response $response): void` - dispatch a Response, sending all its content as set
- `dispatchAndTerminate(Response $response, int $exitCode = 0): void` - dispatch a Response and terminate, i.e., ending program flow immediately afterwards

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

[](#contributing)

Any suggestions, bug reports or general feedback is welcome. Use github issues and pull requests, or find me over at [devvoh.com](https://devvoh.com).

License
-------

[](#license)

All Parable components are open-source software, licensed under the MIT license.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance43

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

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

Recently: every ~369 days

Total

12

Last Release

452d ago

Major Versions

0.5.2 → 1.0.02021-03-12

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

0.4.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7db40df70c77a9d591de4521642b0ddcb6c448e4876b22dc2f76900c736ab579?d=identicon)[robindevoh](/maintainers/robindevoh)

---

Top Contributors

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

---

Tags

httpminimalistparablephp8requestresponsehttpresponserequestmicrolibraryparable

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

7.9k1.0B3.2k](/packages/guzzlehttp-psr7)[chadicus/slim-oauth2-http

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

18455.2k7](/packages/chadicus-slim-oauth2-http)[chillerlan/php-httpinterface

A PSR-7/17/18 http message/client implementation

1417.1k5](/packages/chillerlan-php-httpinterface)

PHPackages © 2026

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