PHPackages                             pcelta/virtual-stream - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pcelta/virtual-stream

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pcelta/virtual-stream
=====================

A Virtual Stream Wrapper

16PHP

Since Aug 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pcelta/virtual-stream)[ Packagist](https://packagist.org/packages/pcelta/virtual-stream)[ RSS](/packages/pcelta-virtual-stream/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/c90dcdb71e641fad031e58d7a7668fb4c6a7d1438432dba8637e4c14d86a0ac0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7063656c74612f7669727475616c2d73747265616d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/pcelta/virtual-stream)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f692bcb5a16f9a97842aa3b17eff064f5645794178790b2e9faeb09688939867/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7063656c74612f7669727475616c2d73747265616d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pcelta/virtual-stream/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/3088972986fe7ee0f7a713d336b67370468a3a6f9889dc414d5b6c6f0d5b914a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7063656c74612f7669727475616c2d73747265616d2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pcelta/virtual-stream/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/51b4dbd929af406578949089620a04bd603f168b1db5e07051e5cec805ed6419/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7063656c74612f7669727475616c2d73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pcelta/virtual-stream)[![Total Downloads](https://camo.githubusercontent.com/1705a2e5b874a28869abf120a2d7a47d6fdc9a83e9fd24e2742d0618d8f89a7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7063656c74612f7669727475616c2d73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pcelta/virtual-stream)[![License](https://camo.githubusercontent.com/1310291cad6b76b65b96907a325282c94c2504a50b6e7fb6f981be8621ebe4cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7063656c74612f7669727475616c2d73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pcelta/virtual-stream)

virtual-stream
==============

[](#virtual-stream)

The Virtual Stream will help you to avoid saving files into filesystem. This is very useful when we're transferring files and testing.

Instalation
-----------

[](#instalation)

```
{
    "require": {
        "pcelta/virtual-stream": "dev-master"
    }
}
```

How to use it
-------------

[](#how-to-use-it)

This library implements StreamWrapper class definition exactly as shown here: .

Basically, this class implements all methods needed to avoid calls to filesystem. For example, in this scenario below you can see many function handling a file resource.

```
$filename = __DIR__ . '/dummy.txt';
$resource = fopen($filename, 'w+');

fwrite($resource, 'first');
fwrite($resource, 'second,');
$result = fread($resource, 20);

fclose($resource);
```

To make sure this example will work you need to give permission on current directory for writing and reading because PHP is going to write it.

That could be avoided using Virtual Stream!

Let's have a look at same example above but right now it is using Virtual Stream.

```
Stream::register(); // register a new StreamWrapper

$filename = sprintf('%s://dummy.txt', Stream::DEFAULT_PROTOCOL);
$resource = fopen($filename, 'w+');

fwrite($resource, 'first');
fwrite($resource, 'second,');
$result = fread($resource, 20);

fclose($resource);

Stream::unregister(); // remove a StreamWrapper registered.
```

In this example, PHP will not use the filesystem to perform these f\* functions.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a424f0b7ef6aea4aef50aa93127fe5cfc21db13184fc6ae87d3e835f1cf4909c?d=identicon)[pcelta](/maintainers/pcelta)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/pcelta-virtual-stream/health.svg)

```
[![Health](https://phpackages.com/badges/pcelta-virtual-stream/health.svg)](https://phpackages.com/packages/pcelta-virtual-stream)
```

PHPackages © 2026

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