aedart/athenaeum-streams

8.10.0 2024-09-04 09:18 UTC

README

"streams" 包提供 PSR-7 定义的 StreamInterface 的扩展版本;这是一个用于常见流操作的包装器,主要用于文件流。

use Aedart\Streams\FileStream;

$stream = FileStream::open('my-file.txt')
    ->put('Hi there');

$more = FileStream::openMemory()
    ->put("\nMore things to show...")
    ->positionToStart();

$stream
    ->append($more);

echo (string) $stream; // Hi there
                       // More things to show...

动机

对于这个包有很多很好的替代方案。遗憾的是,其中一些替代方案使得扩展其功能变得不合理困难。因此,虽然这个包提供了与这些替代方案类似或相同的功能,但它允许您(并鼓励您)扩展此包提供的功能。

use Aedart\Streams\FileStream;

class TranscriptFileStream extends FileStream
{
    // ...your domain-specific logic here ...
}

文档

请阅读官方文档以获取更多信息。

仓库

单一仓库位于 github.com/aedart/athenaeum

版本控制

此包遵循 语义版本控制 2.0.0

许可

BSD-3-Clause,阅读本包中包含的 LICENSE 文件