League CSV now supports streams

One of the long requested feature to be added to the CSV was stream supports. Starting with League\Csv 8.2, the wait is over, you’ll be able to manipulate CSV objects created from a resource stream. As an example you can now do this

Because your CSV object is created using a resource stream you will not be able to use the CSV stream filter capabilities but since you are already using a resource stream, it does not matter because you can directly use PHP’s stream filter capabilities like shown below.

As you can see supporting streams enables more interactions with CSV documents while still using a familiar API.

Final note

The League CSV is an open source project with a MIT License so contributions are more than welcome and will be fully credited. These contributions can be anything from reporting an issue, requesting or adding missing features or simply improving or correcting some typo on the documentation website.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.