{"id":2519,"date":"2015-12-11T13:16:27","date_gmt":"2015-12-11T11:16:27","guid":{"rendered":"http:\/\/nyamsprod.com\/blog\/?p=2519"},"modified":"2015-12-11T13:38:27","modified_gmt":"2015-12-11T11:38:27","slug":"league-csv-8","status":"publish","type":"post","link":"https:\/\/nyamsprod.com\/blog\/league-csv-8\/","title":{"rendered":"League\\Csv 8 and the Reader class"},"content":{"rendered":"<div class=\"message warning\">\n<p><strong>Attention:<\/strong> Les informations de ce billet sont susceptibles d'&ecirc;tre obsol&egrave;tes car vieux de plus 2 ans.<\/p>\n<p><strong>Warning: <\/strong> The information you are reading may be obsolete, this post was published more than 2 years ago.<\/p>\n<\/div><p><a href=\"https:\/\/github.com\/thephpleague\/csv\/blob\/8.0.0\/CHANGELOG.md\" target=\"_blank\">League\\Csv 8<\/a> has been officially released. This new major version requires at least <code>PHP 5.5<\/code> and its corresponding <code>HHVM<\/code> version. Dropping support for <code>PHP 5.4<\/code> makes the code significantly easier to maintain while enabling adding new functionalities. This version is focused on making the <code>Reader<\/code> class simpler as well as more flexible.<!--more--><\/p>\n<h3>What&#8217;s new ?<\/h3>\n<p>This new version introduces two new extracting methods:<\/p>\n<ul>\n<li><code>Reader::fetchPairs<\/code><\/li>\n<li><code>Reader::fetchPairsWithoutDuplicates<\/code><\/li>\n<\/ul>\n<script src=\"https:\/\/gist.github.com\/a0807df54a29d1a89e48.js?file=fetchPairs-generator.php\"><\/script>\n<p>With these additions, all basic retrieving methods that came to be expected from an extracting object are now available for you to use on any CSV document.<\/p>\n<h3>What&#8217;s changed ?<\/h3>\n<p>The <code>Reader<\/code> class <a href=\"http:\/\/csv.thephpleague.com\/reading\/\" target=\"_blank\">has been rewritten to allow better CSV processing<\/a>.<\/p>\n<p>For that purpose methods that previously return <code>array<\/code>, namely, <code>Reader::fetchAssoc<\/code> and <code>Reader::fetchColumn<\/code> now return an <code>Iterator<\/code>. And their optional callable argument for are now easier to use by updating their parameter signature.<\/p>\n<script src=\"https:\/\/gist.github.com\/a0807df54a29d1a89e48.js?file=fetchAssoc-iterator.php\"><\/script>\n<p>The query filter options used by the <code>Reader<\/code> class as well by the CSV conversion methods were reduced to those that where actually useful.<\/p>\n<p>Because of inconsistencies between the <code>Zend Engine<\/code> and <code>HHVM<\/code>, the <code>SplFileObject<\/code> flags can no longer be set or modified.<\/p>\n<p>Last but not least, small backward compatible breaks were introduced into the <code>BOM<\/code> API, to improve the methods return type consistencies.<\/p>\n<h3>Upgrading to the new version<\/h3>\n<p>If you&#8217;ve only use the <code>Writer<\/code> class, then upgrading should be simple as no changes was made to the class public API. If, on the other hand, you&#8217;ve been using the <code>Reader<\/code> class like always:<\/p>\n<ul>\n<li>The upgrading guide: <a href=\"http:\/\/csv.thephpleague.com\/upgrading\/8.0\/\">http:\/\/csv.thephpleague.com\/upgrading\/8.0\/<\/a><\/li>\n<li>and the documentation website:<a href=\"http:\/\/csv.thephpleague.com\/\"> http:\/\/csv.thephpleague.com\/<\/a><\/li>\n<\/ul>\n<p>are there to help you upgrade your code.<\/p>\n<h3>Last but not least<\/h3>\n<p><a href=\"https:\/\/github.com\/thephpleague\/csv\" target=\"_blank\">Csv<\/a> is an open source project with a MIT License so contributions are more than welcome and will be fully credited.\u00a0 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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>League\\Csv 8 is out with a rewritten Reader class to improve extracting CSV contents<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[761,792,785],"class_list":["post-2519","post","type-post","status-publish","format-standard","hentry","category-web","tag-csv","tag-reader","tag-thephpleague"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/posts\/2519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/comments?post=2519"}],"version-history":[{"count":5,"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/posts\/2519\/revisions"}],"predecessor-version":[{"id":2547,"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/posts\/2519\/revisions\/2547"}],"wp:attachment":[{"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/media?parent=2519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/categories?post=2519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nyamsprod.com\/blog\/wp-json\/wp\/v2\/tags?post=2519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}