mintware-de / streams
PSR-7 StreamInterface 的实现
v3.0.0
2024-06-12 10:23 UTC
Requires
- php: ^8.2
- psr/http-message: ^2.0.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^v3.58.1
- phpstan/phpstan: ^1.11.4
- phpunit/phpunit: ^9.0 || ^10.0 || ^11.0
This package is auto-updated.
Last update: 2024-09-12 10:48:53 UTC
README
💾 PHP Streams
本包提供了一些 PSR-7 StreamInterface 的实现。
📦 安装
您可以使用 composer 安装此包。
$ composer require mintware-de/streams
📄 FileStream
提供对文件的读写访问。
use \MintWare\Streams\FileStream; $stream = new FileStream($filename, $readable = true, $writable = true);
💻 MemoryStream
通过此实现,您可以从内存中读取数据并将数据写入内存。
use \MintWare\Streams\MemoryStream; $stream = new MemoryStream($initialData = '');
📥 InputStream
为 php://input
资源提供只读访问。这包括例如原始 HTTP 请求。
use \MintWare\Streams\InputStream; $stream = new InputStream();
📤 OutputStream
为 php://output
资源提供只写访问。
use \MintWare\Streams\OutputStream; $stream = new OutputStream();
🧪 单元测试
$ phpunit
⭐️ 评分
如果您觉得这个包有用,别忘了点击 ⭐️ 星标按钮。谢谢 😊