PHPackages                             simp/streamwrapper - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. simp/streamwrapper

ActiveLibrary[File &amp; Storage](/categories/file-storage)

simp/streamwrapper
==================

This library is implements stream wrapper in php to provide clean file access

v1.0.3(1y ago)0834MITPHP

Since Feb 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/CHANCENY/stream-wrapper)[ Packagist](https://packagist.org/packages/simp/streamwrapper)[ RSS](/packages/simp-streamwrapper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (4)

Stream Wrapper Library
======================

[](#stream-wrapper-library)

This library provides a custom PHP **Stream Wrapper**, allowing you to register and use custom stream protocols (`public://` and `global://`) for file operations like reading and writing.

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

[](#installation)

1. **Clone the repository** or download the package into your project.
2. **Install dependencies** using Composer:

    ```
    composer require simp/streamwrapper
    ```

Usage
-----

[](#usage)

### 1. Registering Custom Stream Wrappers

[](#1-registering-custom-stream-wrappers)

The package uses `WrapperRegister` to register custom stream wrappers.

```
use Simp\StreamWrapper\Stream\GlobalStreamWrapper;
use Simp\StreamWrapper\WrapperRegister\WrapperRegister;

require_once "vendor/autoload.php";
require_once "PublicWrapper.php";

// Registering the global and public stream wrappers
WrapperRegister::register("global", GlobalStreamWrapper::class);
WrapperRegister::register("public", PublicWrapper::class);
```

### 2. Using the Registered Wrappers

[](#2-using-the-registered-wrappers)

Once registered, you can perform file operations using `global://` and `public://` as stream wrappers.

```
// Writing and reading using global wrapper
file_put_contents("global://example.txt", "\nLorem ipsum dolor sit amet\n", FILE_APPEND);
echo file_get_contents("global://example.txt");

// Writing and reading using public wrapper
file_put_contents("public://example.txt", "\nHello World!\n", FILE_APPEND);
echo file_get_contents("public://example.txt");
```

### 3. Customizing the Public Wrapper

[](#3-customizing-the-public-wrapper)

The `PublicWrapper.php` file extends the base `StreamWrapper` class, setting a custom `$stream_name` and `$base_path`:

```
class PublicWrapper extends \Simp\StreamWrapper\Stream\StreamWrapper
{
    protected string $stream_name = "public";
    protected string $basePath = "sites/public";
}
```

Modify the `$basePath` to change where files are stored when using `public://` paths.

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

[](#requirements)

- PHP 8.0 or higher
- Composer for dependency management

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance43

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

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

Total

4

Last Release

450d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6097a3277a85cf902ab5d617af1515359091563d1d288dd969e59ca50646a782?d=identicon)[Chance007](/maintainers/Chance007)

---

Top Contributors

[![CHANCENY](https://avatars.githubusercontent.com/u/96126430?v=4)](https://github.com/CHANCENY "CHANCENY (8 commits)")

### Embed Badge

![Health badge](/badges/simp-streamwrapper/health.svg)

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M123](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M61](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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