ancarda / psr7-string-stream
基于字符串的最小PSR-7 StreamInterface实现
1.3.1
2022-01-16 14:40 UTC
Requires
- php: ^7.3|^8.0
- psr/http-message: ^1.0
Requires (Dev)
- ancarda/coverage-enforcer: ^1.0
- composer/package-versions-deprecated: 1.11.99.1
- infection/infection: ^0.18.2
- phpstan/phpstan: ^0.12.82
- phpstan/phpstan-phpunit: ^0.12.18
- phpstan/phpstan-strict-rules: ^0.12.9
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
README
基于字符串的最小PSR-7 StreamInterface实现
PSR-7 String Stream诞生于使用PSR-7的StreamInterface时的挫败感。大多数实现通常使用PHP Streams,这在操作上并不理想。我曾遇到过无害操作如withHeaders
导致底层Body的析构函数被调用,进而关闭底层流。由于资源不能被克隆,这可能导致Body被销毁。
本包,正如其名所示,使用字符串实现StreamInterface,这将能够支持克隆和销毁操作。
如果您在生产环境中使用此包,
composer require ancarda/psr7-string-stream
如果您只是在使用此包进行功能或单元测试,它可以在您的require-dev
部分
composer require --dev ancarda/psr7-string-stream