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

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

initphp/http
============

HTTP

2.1(2y ago)11814MITPHPPHP &gt;=7.4

Since Mar 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/InitPHP/HTTP)[ Packagist](https://packagist.org/packages/initphp/http)[ RSS](/packages/initphp-http/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (3)Versions (9)Used By (4)

InitPHP HTTP
============

[](#initphp-http)

This library provides HTTP Message and HTTP Factory solution following PSR-7 and PSR-17 standards. It also includes an Emitter class for the PSR-7.

[![Latest Stable Version](https://camo.githubusercontent.com/9c00ff6ed0595961b93f59189b562e40604578a267352f967e7781caa508334a/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f687474702f76)](https://packagist.org/packages/initphp/http) [![Total Downloads](https://camo.githubusercontent.com/29872ff9bb387d6d5e2141a4e265c1e56f6a6ba229f0c6f56f27cd16c3dec378/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f687474702f646f776e6c6f616473)](https://packagist.org/packages/initphp/http) [![Latest Unstable Version](https://camo.githubusercontent.com/6fa0e041f9814273d5cf20806b61f2f15369ca6a618c66e6aacf8afda24561ad/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f687474702f762f756e737461626c65)](https://packagist.org/packages/initphp/http) [![License](https://camo.githubusercontent.com/050a8eadecc421ea0b02470c4cfde3bf23aaf915e5474d320a2f361d197edcba/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f687474702f6c6963656e7365)](https://packagist.org/packages/initphp/http) [![PHP Version Require](https://camo.githubusercontent.com/e669f94bdd80aa2a1688f6b7bba55733fcd5881b6eb54478f251277eab26b5bb/687474703a2f2f706f7365722e707567782e6f72672f696e69747068702f687474702f726571756972652f706870)](https://packagist.org/packages/initphp/http)

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

[](#requirements)

- PHP 7.4 or higher
- PSR-7 HTTP Message Interfaces
- PSR-17 HTTP Factories Interfaces
- PSR-18 HTTP Client Interfaces

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

[](#installation)

```
composer require initphp/http

```

Usage
-----

[](#usage)

It adheres to the PSR-7, PSR-17, PSR-18 standards and strictly implements these interfaces to a large extent.

### PSR-7 Emitter Usage

[](#psr-7-emitter-usage)

```
use \InitPHP\HTTP\Message\{Response, Stream};
use \InitPHP\HTTP\Emitter\Emitter;

$response = new Response(200, [], new Stream('Hello World', null), '1.1');

$emitter = new Emitter();
$emitter->emit($response);
```

or

```
use \InitPHP\HTTP\Facade\Factory;
use \InitPHP\HTTP\Facade\Emitter;

$response = Factory::createResponse(200);
$response->getBody()->write('Hello World');

Emitter::emit($response);
```

### PSR-17 Factory Usage

[](#psr-17-factory-usage)

```
use \InitPHP\HTTP\Factory\Factory;

$httpFactory = new Factory();

/** @var \Psr\Http\Message\RequestInterface $request */
$request = $httpFactory->createRequest('GET', 'http://example.com');

// ...
```

or

```
use InitPHP\HTTP\Facade\Factory;

/** @var \Psr\Http\Message\RequestInterface $request */
$request = Factory::createRequest('GET', 'http://example.com');
```

### PSR-18 Client Usage

[](#psr-18-client-usage)

```
use \InitPHP\HTTP\Message\Request;
use \InitPHP\HTTP\Client\Client;

$request = new Request('GET', 'http://example.com');

$client = new Client();

/** @var \Psr\Http\Message\ResponseInterface $response */
$response = $client->sendRequest($request);
```

or

```
use \InitPHP\HTTP\Facade\Factory;
use \InitPHP\HTTP\Facade\Client;

$request = Factory::createRequest('GET', 'http://example.com');

/** @var \Psr\Http\Message\ResponseInterface $response */
$response = Client::sendRequest($request);
```

#### A Small Difference For PSR-7 Stream

[](#a-small-difference-for-psr-7-stream)

If you are working with small content; The PSR-7 Stream interface may be cumbersome for you. This is because the PSR-7 stream interface writes the content "`php://temp`" or "`php://memory`". By default this library will also overwrite `php://temp` with your content. To change this behavior, this must be declared as the second parameter to the constructor method when creating the Stream object.

```
use \InitPHP\HTTP\Stream;

/**
 * This content is kept in memory as a variable.
 */
$variableStream = new Stream('String Content', null);

/**
 * Content; "php://memory" is overwritten.
 */
$memoryStream = new Stream('Content', 'php://memory');

/**
 * Content; "php://temp" is overwritten.
 */
$tempStream = new Stream('Content', 'php://temp');
// or new Stream('Content');
```

Credits
-------

[](#credits)

- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) &lt;&gt;

License
-------

[](#license)

Copyright © 2022 [MIT License](./LICENSE)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Recently: every ~94 days

Total

8

Last Release

994d ago

Major Versions

1.0.3 → 2.0.x-dev2023-03-16

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

emitterhttp-emitterhttp-messagephpphp-httpphp7psr-17psr-7psr7-handlerpsr7-httppsr7-requestpsr7-response

### Embed Badge

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

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

###  Alternatives

[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[spiral/roadrunner-http

RoadRunner: HTTP and PSR-7 worker

779.2M48](/packages/spiral-roadrunner-http)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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