GithubHelp home page GithubHelp logo

andriariii / csv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thephpleague/csv

0.0 2.0 0.0 760 KB

CSV data manipulation made easy in PHP

Home Page: http://csv.thephpleague.com/

License: MIT License

csv's Introduction

CSV

Build Status Coverage Status Total Downloads Latest Stable Version

League\Csv is a simple library to ease CSV parsing, writing and filtering in PHP. The goal of the library is to be as powerful while remaining lightweight, by utilizing PHP native classes whenever possible.

League\Csv was designed for developers who wants to deal with CSV data using modern code and without the high levels of bootstrap and low-levels of usefulness provided by existing core functions or third party-code.

This package is compliant with PSR-1, PSR-2, and PSR-4.

System Requirements

You need PHP >= 5.4.0 and the mbstring extension to use League\Csv but the latest stable version of PHP is recommended.

Install

Install the csv package with Composer.

{
    "require": {
        "league/csv": "5.*"
    }
}

Documentation

Csv has full documentation, powered by Sculpin.

Contribute to this documentation in the sculpin branch.

Tips

  • When creating a file using the library, first insert all the data that need to be inserted before starting manipulating the CSV. If you manipulate your data before insertion, you may change the file cursor position and get unexpected results.

  • If you are dealing with non-unicode data, specify the encoding parameter using the setEncoding method otherwise your output conversions may no work.

  • If you have your LC_CTYPE set to a locale that's using UTF-8 and you try to parse a file that's not in UTF-8, PHP will cut your fields the moment it encounters a byte it can't understand (i.e. any outside of ASCII that doesn't happen to be part of a UTF-8 character which it likely isn't). This gist will show you a possible solution to this problem by using PHP stream filter. This tip is from Philip Hofstetter

  • When merging multiples CSV documents don't forget to set the main CSV object as a League\Csv\Writer object with the $open_mode = 'a+' to preserve its content. This setting is of course not required when your main League\Csv\Writer object is created from String

  • If you are on a Mac OS X Server, add the following lines before using the library to help PHP detect line ending in Mac OS X.

if (! ini_get("auto_detect_line_endings")) {
    ini_set("auto_detect_line_endings", true);
}

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

Bitdeli Badge

csv's People

Contributors

nyamsprod avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.