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

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

effectra/http-message
=====================

The Effectra HTTP Message package.

v1.0.3(2y ago)06815MITPHPPHP ^8.0.2

Since Jul 24Pushed 2y agoCompare

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

READMEChangelog (4)Dependencies (1)Versions (5)Used By (5)

Effectra HTTP Message Library
=============================

[](#effectra-http-message-library)

A lightweight PHP library for working with HTTP messages.

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

[](#installation)

Install the library using Composer:

```
composer require effectra/http-message
```

Usage
-----

[](#usage)

### Creating a Request

[](#creating-a-request)

```
use Effectra\Http\Message\Request;
use Effectra\Http\Message\Uri;
use Effectra\Http\Message\Stream;

// Create a request
$uri = new Uri('https://api.example.com/users');
$body = new Stream(json_encode(['name' => 'John Doe']));

$request = new Request('POST', $uri, [], $body);

// Get request information
echo $request->getMethod(); // Output: POST
echo $request->getUri(); // Output: https://api.example.com/users
echo $request->getBody()->getContents(); // Output: {"name":"John Doe"}
```

### Creating a Response

[](#creating-a-response)

```
use Effectra\Http\Message\Response;
use Effectra\Http\Message\Stream;

// Create a response
$body = new Stream('Hello, world!');

$response = new Response(200, [], $body);

// Get response information
echo $response->getStatusCode(); // Output: 200
echo $response->getReasonPhrase(); // Output: OK
echo $response->getBody()->getContents(); // Output: Hello, world!
```

### Creating a Stream

[](#creating-a-stream)

```
use Effectra\Http\Message\Stream;

// Create a stream from a string
$stream = new Stream('Hello, world!');

// Read from the stream
echo $stream->getContents(); // Output: Hello, world!

// Write to the stream
$stream->write('Goodbye!');
echo $stream->getContents(); // Output: Goodbye!
```

### Working with Uploaded Files

[](#working-with-uploaded-files)

```
use Effectra\Http\Message\UploadedFile;

// Create an uploaded file instance
$file = $_FILES['my_file'];

$uploadedFile = new UploadedFile(
    $file['tmp_name'],
    $file['size'],
    $file['error'],
    $file['name'],
    $file['type']
);

// Get information about the uploaded file
echo $uploadedFile->getClientFilename(); // Output: my_file.txt
echo $uploadedFile->getClientMediaType(); // Output: text/plain

// Move the uploaded file to a target location
$targetPath = '/path/to/destination';
$uploadedFile->moveTo($targetPath);
```

### Working with URIs

[](#working-with-uris)

```
use Effectra\Http\Message\Uri;

// Create a URI instance
$uri = new Uri('https://example.com/path?query=param#fragment');

// Get individual URI components
echo $uri->getScheme(); // Output: https
echo $uri->getHost(); // Output: example.com
echo $uri->getPath(); // Output: /path
echo $uri->getQuery(); // Output: query=param
echo $uri->getFragment(); // Output: fragment

// Modify the URI components
$modifiedUri = $uri
    ->withScheme('http')
    ->withHost('example.org')
    ->withPath('/new-path')
    ->withQuery('key=value')
    ->withFragment('new-fragment');

echo $modifiedUri; // Output: http://example.org/new-path?key=value#new-fragment
```

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

[](#contributing)

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.

License
-------

[](#license)

This library is released under the MIT License. See [LICENSE](LICENSE) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

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

Total

4

Last Release

862d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

httphttp-messagephppsrpsr-7requestresponseserver-requeststreamupload-fileuri

### Embed Badge

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

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

###  Alternatives

[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

538204.9M23](/packages/league-uri-interfaces)[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[laudis/neo4j-php-client

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

184616.9k31](/packages/laudis-neo4j-php-client)[http-interop/response-sender

A function to convert PSR-7 Response to HTTP output

46711.5k40](/packages/http-interop-response-sender)[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)

PHPackages © 2026

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