Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 28 million developers.Sign up
In this release, I mainly spent time on basically internal issues. I added an
IO\Resource class, an object-oriented representation of native PHP stream resource objects. I also added a
Collection class, which is basically just an array wrapper with a whole slew of convenient methods. All CSVelte classes now use Collection objects internally rather than arrays. Finally, I implemented a series of namespaced functions. Most of them are simply factory functions (shortcuts for generating objects) and/or facade functions (shortcuts for tedious object composition). For a full list of changes, refer to the CHANGELOG excerpt below.
- Added IO\Resource class to represent a PHP stream resource. Now CSVelte will expect/return an IO\Resource object where before it was a native PHP stream resource (#114, #124 and #135).
- Implemented "lazy-open" streams by means of the IO\Resource class I mentioned before (#121).
- Replaced Readable, Writable, and Seekable interfaces with the much simpler Streamable interface (#107).
- Added BufferStream class. Any time I need a simple buffer object within CSVelte, I will now use this class (#126).
- Used the aforementioned BufferStream class to write the IteratorStream class, which loops over an iterator and fills up a buffer that it can then read from until it's empty and the process starts again (#122).
- Added the Collection class, which is simply a wrapper for an array with a multitude of very convenient methods. Many classes now use this class internally rather than an array. This class replaces the old Utils class (which was only used internally anyway, it was never part of the public API, whereas Collection may eventually be)
- Added the following namespaced factory and helper functions under the "CSVelte" namespace.
- CSVelte\streamize - a very forgiving IO\Stream object factory (accepts strings, iterators, SplFileObjects, IO\Resource objects, and stream resource variables) (#123)
- CSVelte\stream - a less forgiving IO\Stream object factory (only accepts a stream URI)
- CSVelte\stream_resource - IO\Resource object factory
- CSVelte\taste - a convenience function that instantiates a Taster object and then calls its "taste" method
- CSVelte\taste_has_header - a convenience function that instantiates a Taster object and then calls its "hasHeader" method
- CSVelte\collect - a Collection object factory
- CSVelte\invoke - a convenience function that accepts an anonymous function/closure, invokes it, and immediately returns the result
- Removed Carbon dependency (#128)
- Added __invoke() magic method to IO\Stream and various other classes.
- Refactored the Taster class as much as possible, although there is still much work to be done on it (#1).
- Removed all remaining filesystem-reliant unit tests. All filesystem tests now substitute the vfsStream class for the actual filesystem now.
- Fixed bug that was causing PHP7 build to fail (#149)
- Added a phpcs.xml.dist file, although I am not yet actually running the coding style fixer (that will be in the next version hopefully) (#153)
- Fixed a whole slew of docblock inconsistencies, unused class imports, etc.
- Improved the documentation at http://csvelte.phpcsv.com/
This release mainly focused on clean-up tasks. Some of them internal, such as unit tests, build improvements (travis, scrutinizer, etc.) and additional code comments. The rest are API clean-up, such as what's outlined below. I intend to continue improving on the
IO\Stream class and related classes in subsequent v0.2.x releases. Stay tuned!
Also made major improvements to the documentation, so check that out (http://csvelte.phpcsv.com/)
- Fixed issues causing PHP7 build failures (#75)
- Refactored I/O classes, combining the Input and Output namespaces and classes into a single IO\Stream class. (#97, #99, #108, #115 and various others)
- Created new
src/autoload.phpfile, rather than requiring autoloader users to include
Reader::toArray()method to convert a CSV dataset to a two-dimensional array (#105)
- Refactored Readable, Writable, and Seekable interfaces (#97 and various others)
- Reader, writer and anywhere else that accepts a
Flavorobject can now also accept an associative array of flavor attributes that will override the default flavor (#54)
- Documentation rewritten almost completely, many sections elaborated and clarified, as well as better organization (#87 and #95)
- Various other minor bug fixes, additional unit tests, and code improvements
Introducing CSVelte! A slender, elegant CSV library for PHP.
CSVelte is a simple yet flexible CSV and tabular data library for PHP5.6+. It was written, originally, as a pseudo-port of Python’s CSV module in early 2008. It was the result of the author’s dissatisfaction with not only PHP’s native CSV handling functions, but also with the lack of quality third-party PHP libraries for CSV and tabular data in general. Unfortunately, due to its author’s personal and professional obligations, that original library (PHP CSV Utilities or PCU) was abandoned before it even reached API stability (the last version was 0.3). Recently however, its author has had a bit of spare time and so decided to revive PCU, rewriting it from the ground up using modern PHP best practices and tools over a solid foundation of object-oriented design principles and re-introducing it to the world as CSVelte (pronounced just like the word svelte).
This is, of course, a pre-release and should not be considered production ready. Use it as your own risk. Its API is subject to change at any time without warning until it reaches v1.0.
What's included in this release?
This is the first official release of CSVelte and contains only the bare minimum of what is required to call itself a CSV library. It can read and write CSV from local files, streams, and PHP strings. It is capable of reading/writing CSV files regardless of how they're formatted and it can even automatically detect CSV format.
For more information about what it's capable of so far, check out the documentation.
This is the CSVelte version 0.1 preview release. The official release will take place on Monday, August 15th, 2016. I'm pushing out this preview release more for myself than for any potential users. I'm using several products/services that I'm not familiar with for continuous integration, quality assurance, code sniffing, documentation, etc. and I'm pushing this preview release to make sure I've got them all configured properly so that hopefully, by Monday morning I'll have worked all the kinks out of my release automation and the official release of version 0.1 of CSVelte will go off without a hitch.
What's included in this release?
This release contains just the bare minimum of what I feel is required for CSVelte to call itself a CSV library. It has reader and writer objects, both with multiple input and output source classes, respectively. For instance, the reader can read from a stream, a file, or a standard PHP string. The writer can write to a stream or a file. Other than that, there's a class I call the "Taster" which is used to detect a file's particular "flavor" of CSV (what it uses as the dilimiter, the line endings, quote character, etc.). The official release will provide much more detail on what's included.
What's not included in this release?
This release does not include proper documentation. Only auto-generated API documentation a la PHPDocumentor, except it uses the much more lightweight, cleaner (in my opinion), ApiGen. The official v0.1 release will be meticulously documented using ReadTheDocs.org. It will contain guides, tutorials and reference material for every aspect of the library. A library is only as good as its documentation. In my experience, a well-documented piece of s*** is much more useful than a poorly documented masterpiece.
Also not included in this release, are PHP5.4, PHP5.5 and PHP7.x support. The only supported version of PHP, for now, is PHP5.6. This will likely still be the case by Monday when I release v0.1 officially. But by v0.2 or v0.3 I expect to lower the mimimum supported version to 5.4 and by v0.1 (hopefully much sooner) I intend to also support PHP7.x. What about PHP6.x? LOL seriously? Where have you been? Get with the times, yo!