Download the PHP package ho-nl-fork/psr7-csv-factory without Composer
On this page you can find all versions of the php package ho-nl-fork/psr7-csv-factory. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ho-nl-fork/psr7-csv-factory
More information about ho-nl-fork/psr7-csv-factory
Files in ho-nl-fork/psr7-csv-factory
Package psr7-csv-factory
Short Description a factory to return league csv object from PSR-7 StreamInterface
License MIT
Homepage https://github.com/bakame-php/psr7-csv-factory
Informations about the package psr7-csv-factory
Bakame PSR-7 Adapter
This package enables converting a League CSV object package.
The included StreamWrapper class is heavily inspired/copied from the excellent Guzzle/Psr7 package written by Michael Dowling which uses the MIT License
Requirements
You need PHP >= 7.3 but the latest stable version of PHP is recommended.
- A Slim, etc...)
Installation
Install bakame/psr7-adapter using Composer.
Documentation
StreamWrapper::streamToResource
StreamWrapper::streamToAppendableResource
returns a PHP stream resource from a PSR-7 StreamInterface object.
Parameters
$stream: a object implementing PSR-7StreamInterfaceinterface.
Returned values
A PHP stream resource
Exception
A Bakame\Psr7\Adapter\UnableToWrapStream will be triggered when the following situations are encountered:
- If the
StreamInterfaceis not readable and writable - If the stream resource could not be created.
Usage example
Here's a simple usage with League\Csv.
In both cases, the StreamInterface objects are never detached or removed from their parent objects (ie the Request object or the Response object), the CSV objects operate on their StreamInterface property using the adapter stream returned by resource_from.
Testing
The package has:
- a PHPUnit test suite
- a coding style compliance test suite using PHP CS Fixer.
- a code analysis compliance test suite using PHPStan.
To run the tests, run the following command from the project folder.
Contributing
Contributions are welcome and will be fully credited. Please see CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see LICENSE for more information.