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)083MITPHP

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 today

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

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

27

—

LowBetter than 52% of packages

Maintenance46

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

401d 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.2M116](/packages/knplabs-gaufrette)[aws/aws-sdk-php-laravel

A simple Laravel 6/7/8/9/10/11/12 service provider for including the AWS SDK for PHP.

1.7k34.8M69](/packages/aws-aws-sdk-php-laravel)[vich/uploader-bundle

Ease file uploads attached to entities

1.9k25.4M107](/packages/vich-uploader-bundle)[spatie/simple-excel

Read and write simple Excel and CSV files

1.3k9.4M39](/packages/spatie-simple-excel)[knplabs/knp-gaufrette-bundle

Allows to easily use the Gaufrette library in a Symfony project

73628.2M84](/packages/knplabs-knp-gaufrette-bundle)[google/cloud-storage

Cloud Storage Client for PHP

34388.1M95](/packages/google-cloud-storage)

PHPackages © 2026

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