PHPackages                             kambo/httpstream - 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. kambo/httpstream

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

kambo/httpstream
================

Kambo httpstream additional streams for the PSR-7

v0.9.0(9y ago)119MITPHPPHP &gt;=5.5

Since Aug 13Pushed 9y ago1 watchersCompare

[ Source](https://github.com/kambo-1st/HttpStream)[ Packagist](https://packagist.org/packages/kambo/httpstream)[ RSS](/packages/kambo-httpstream/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (3)Versions (1)Used By (0)

kambo httpstream
================

[](#kambo-httpstream)

[![Build Status](https://camo.githubusercontent.com/3da1cfe706a12fb400ad413dda84de816b671d4d38bab3776572fe9a4a099355/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6b616d626f2d3173742f4874747053747265616d2e7376673f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://travis-ci.org/kambo-1st/HttpStream)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/69d429b2594f50c6b6127ff472199af393b5062d0082d2c8f78f532f692b7aba/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6b616d626f2d3173742f4874747053747265616d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/kambo-1st/HttpStream/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c7f7ea5765ccd5ca99378f18481ae0181d746561da70fefd3351d5a9eeaa9df7/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6b616d626f2d3173742f4874747053747265616d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/kambo-1st/HttpStream/)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Implementation of additional streams for the PSR-7 - HTTP message interfaces

### Stream implementation

[](#stream-implementation)

This package comes with a following stream implementations:

- string stream
- callback stream

Each of these stream offers additional functionality not provided by original PSR-7 stream implementations.

Install
-------

[](#install)

Prefered way to install library is with composer:

```
composer require kambo/httpstream
```

### Basic usage

[](#basic-usage)

### StringStream

[](#stringstream)

String stream is simple synthetic sugar that allows instantiation of stream from the string. Implementation create temporary resource which will be used as base for the StringStream and it is fully compatible with the PSR-7 stream.

```
$stringStream = new StringStream('foo');
$stringStream->getContents(); // returns 'foo'
```

### CallbackStream

[](#callbackstream)

Callback stream provides a readonly stream wrapper around given callback function. Callback will be executed only once by invoking method getContents or by casting object into string. Result of function is not cached and whole stream is after callback invocation in unusable state. This gravely limit usage of methods tell, seek, rewind and read. They cannot be used and invoking any of them will throw exception.

```
$callback = function () {
    return 'bar';
};
$callbackStream = new CallbackStream($callback);
$callbackStream->getContents(); // Invoke function and returns 'bar'.
$callbackStream->getContents(); // stream is in detached state empty string ('') has been returned.
```

License
-------

[](#license)

The MIT License (MIT),

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

3608d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1073586?v=4)[Øystein Kambo Tangerås](/maintainers/kambo)[@kambo](https://github.com/kambo)

---

Top Contributors

[![kambo-1st](https://avatars.githubusercontent.com/u/6493048?v=4)](https://github.com/kambo-1st "kambo-1st (6 commits)")

---

Tags

httppsr-7Streamshttpmessage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kambo-httpstream/health.svg)

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

###  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)[symfony/psr-http-message-bridge

PSR HTTP message bridge

1.3k312.3M931](/packages/symfony-psr-http-message-bridge)[php-http/message

HTTP Message related tools

1.3k273.8M736](/packages/php-http-message)[league/uri

URI manipulation library

1.1k228.3M364](/packages/league-uri)

PHPackages © 2026

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