PHPackages                             chevere/writer - 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. chevere/writer

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

chevere/writer
==============

Tooling for writing to streams

1.0.3(1y ago)128.2k↓16.5%2Apache-2.0PHPPHP ^8.1CI passing

Since Dec 2Pushed 1y agoCompare

[ Source](https://github.com/chevere/writer)[ Packagist](https://packagist.org/packages/chevere/writer)[ Docs](https://chevere.org)[ RSS](/packages/chevere-writer/feed)WikiDiscussions 1.0 Synced 2d ago

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

Writer
======

[](#writer)

[![Chevere](chevere.svg)](chevere.svg)

[![Build](https://camo.githubusercontent.com/cc789d02c0699711f4767ee83e6e6275ad5c5f89ef1cfb12773cbed5b94e6e55/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636865766572652f7772697465722f746573742e796d6c3f6272616e63683d312e30267374796c653d666c61742d737175617265)](https://github.com/chevere/writer/actions)[![Code size](https://camo.githubusercontent.com/fbc2185fd8784e26c72a680f16b4c64be0a52ac59351372006cbc53725ecdc60/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f636865766572652f7772697465723f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/fbc2185fd8784e26c72a680f16b4c64be0a52ac59351372006cbc53725ecdc60/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f636865766572652f7772697465723f7374796c653d666c61742d737175617265)[![Apache-2.0](https://camo.githubusercontent.com/a79f26fa418154c180e4a1765a2a01cfa25c4610560115ffa5cbe3f4f9356924/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636865766572652f7772697465723f7374796c653d666c61742d737175617265)](LICENSE)[![PHPStan](https://camo.githubusercontent.com/6016298b28550819030c76e9327f62501596a31fd76406695bae2f3d2a1f26a4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d626c756576696f6c65743f7374796c653d666c61742d737175617265)](https://phpstan.org/)[![Mutation testing badge](https://camo.githubusercontent.com/b9bf5c770c2834baab3f6168b7a7b930108c48fcbdedd4def0676ff65bc68abc/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742d7371756172652675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d25324663686576657265253246777269746572253246312e30)](https://dashboard.stryker-mutator.io/reports/github.com/chevere/writer/1.0)

[![Quality Gate Status](https://camo.githubusercontent.com/600dc46ece8d0e8e6c8908c9a9ae360862b98b1f394239c1e9d45147c00629e1/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d636865766572655f777269746572266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/dashboard?id=chevere_writer)[![Maintainability Rating](https://camo.githubusercontent.com/24c819eac197ac539c672e8b8c983d3f40a713fdd5d6380c5268a242d194f010/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d636865766572655f777269746572266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/dashboard?id=chevere_writer)[![Reliability Rating](https://camo.githubusercontent.com/1486e9e7af0618c13350ee117e7d61ebdc5ea66437a1e666e9b5184872ff9e53/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d636865766572655f777269746572266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/dashboard?id=chevere_writer)[![Security Rating](https://camo.githubusercontent.com/cd9c03a5fb608386f814756619387c57b0b1f4c93f393840c0fbf26480d7e5b8/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d636865766572655f777269746572266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/dashboard?id=chevere_writer)[![Coverage](https://camo.githubusercontent.com/1391d570e77f83657e8b16e595a46d0c8e5255905c38b47fe999113c7d76e878/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d636865766572655f777269746572266d65747269633d636f766572616765)](https://sonarcloud.io/dashboard?id=chevere_writer)[![Technical Debt](https://camo.githubusercontent.com/61d2aa43a59a96176348e3caa15395e4c5efc2c1b933d4f8e7fe51e8edf8576f/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d636865766572655f777269746572266d65747269633d7371616c655f696e646578)](https://sonarcloud.io/dashboard?id=chevere_writer)[![CodeFactor](https://camo.githubusercontent.com/15b8fd5a6e44732405d56a3ebb222afd99f8a0028c5f3114f6601cf969c14846/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f636865766572652f7772697465722f6261646765)](https://www.codefactor.io/repository/github/chevere/writer)

Summary
-------

[](#summary)

Writer provides tooling for writing to streams.

Installing
----------

[](#installing)

Writer is available through [Packagist](https://packagist.org/packages/chevere/writer) and the repository source is at [chevere/writer](https://github.com/chevere/writer).

```
composer require chevere/writer
```

Streams
-------

[](#streams)

### Stream for

[](#stream-for)

Use function `streamFor` to create an stream.

```
use function Chevere\Writer\streamFor;

$stream = streamFor(
    stream: 'php://temp',
    mode: 'r+'
);
```

### Stream temp

[](#stream-temp)

Use function `streamTemp` to create a temp stream (rw+).

```
use function Chevere\Writer\streamTemp;

$stream = streamTemp($content);
```

StreamWriter
------------

[](#streamwriter)

Use `StreamWriter` to write strings to a stream.

```
use Chevere\Writer\StreamWriter;
use function Chevere\Writer\streamFor;

$stream = streamFor('php://output', 'r');
$writer = new StreamWriter($stream);
$writer->write('Hello, world!');
```

NullWriter
----------

[](#nullwriter)

Use `NullWriter` when requiring `null` write override.

Writers
-------

[](#writers)

Use `Writers` to interact with pre-defined streams for output, error, debug and log. By default only output and error streams are defined.

StreamDefaultoutputStreamWritererrorStreamWriterdebugNullWriterlogNullWriter```
use Chevere\Writer\Writers;

$writers = new Writers();
$writers->error();
$writers->debug();
$writers->log();
```

### Output stream

[](#output-stream)

Use `output` to interact with the output stream. Use `withOutput` to set a custom output stream.

```
$with = $writers->withOutput($stream);
$with->output(); // $stream
```

### Error stream

[](#error-stream)

Use `error` to interact with the error stream. Use `withError` to set a custom error stream.

```
$with = $writers->withError($stream);
$with->error(); // $stream
```

### Debug stream

[](#debug-stream)

Use `debug` to interact with the debug stream. Use `withDebug` to set a custom debug stream.

```
$with = $writers->withDebug($stream);
$with->debug(); // $stream
```

### Log stream

[](#log-stream)

Use `log` to interact with the log stream. Use `withLog` to set a custom log stream.

```
$with = $writers->withLog($stream);
$with->log(); // $stream
```

Documentation
-------------

[](#documentation)

Documentation is available at [chevere.org](https://chevere.org/packages/writer).

License
-------

[](#license)

Copyright [Rodolfo Berrios A.](https://rodolfoberrios.com/)

Chevere is licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full license text.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance40

Moderate activity, may be stable

Popularity30

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

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

Total

5

Last Release

484d ago

### Community

Maintainers

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

---

Top Contributors

[![rodber](https://avatars.githubusercontent.com/u/20590102?v=4)](https://github.com/rodber "rodber (16 commits)")

---

Tags

cheverephpphp-library

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/chevere-writer/health.svg)

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[google/cloud-core

Google Cloud PHP shared dependency, providing functionality useful to all components.

346132.9M112](/packages/google-cloud-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[anthropic-ai/sdk

Anthropic PHP SDK

163583.3k17](/packages/anthropic-ai-sdk)

PHPackages © 2026

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