2017 © Pedro Peláez
 

symfony-bundle csv-bundle

Converting an array to CSV and vice versa.

image

kuborgh/csv-bundle

Converting an array to CSV and vice versa.

  • Wednesday, September 7, 2016
  • by kuborgh-hgiesenow
  • Repository
  • 2 Watchers
  • 3 Stars
  • 4,379 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 5 % Grown

The README.md

CSV Bundle

![Build Status][travis-image] This bundle is intended to be simple, but rfc4180 conform csv parser and writer. It will be extended in the future to fit more and more needs of custom implementations., (*1)

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*2)

$ composer require kuborgh/csv-bundle

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:, (*3)

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Kuborgh\CsvBundle\KuborghCsvBundle(),
        );

        // ...
    }

    // ...
}

Configuration

Following configuration variables exist an can be inserted into the config.yml of your project, (*4)

kuborgh_csv:
    parser:
        # Add here as many parser as you need. Each will get it's own service kuborgh_csv.parser.my_parser
        my_parser:
            # Delimiter (default: ",")
            delimiter: ","

            # Line Ending (default: "\r\n")
            line_ending: "\r\n"

            # Implementation for the parser. Possible values are "character" (default) oder "simple" (not recommended).
            # You can add your own parser implementation by registering the class name in parameters like  
            # kuborgh_csv.parser.<my_implementation>.class 
            implementation: character

    generator:
        # Add here as many generators as you need. Each will get it's own service kuborgh_csv.generator.my_generator
        my_generator:
            # Delimiter (default: ",")
            delimiter: ","

            # Line Ending (default: "\r\n")
            line_ending: "\r\n"

            # Implementation for the generator. Possible values are "string" (default) oder "php" (not recommended).
            # You can add your own generatr implementation by registering the class name in parameters like  
            # kuborgh_csv.generator.<my_implementation>.class 
            implementation: string

Usage

To parse CSV you simply call, (*5)

$parser = $container->get('kuborgh_csv.parser.<my_parser>');
$array = $parser->parse($csv);

To generate CSV you simply call, (*6)

$generator = $container->get('kuborgh_csv.generator.<my_generator>');
$csv = $generator->generate($array);

Testing

The whole parser should be unittested. You can run the tests with, (*7)

$ composer install
$ bin/phpunit

The coverage report is saved in the coverage folder and should always cover 100%, (*8)

The Versions

07/09 2016

dev-master

9999999-dev https://github.com/kuborgh/csv-bundle

Converting an array to CSV and vice versa.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hannes Giesenow

csv library excel array rfc4180

07/09 2016

v1.0.1

1.0.1.0 https://github.com/kuborgh/csv-bundle

Converting an array to CSV and vice versa.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hannes Giesenow

csv library excel array rfc4180

19/01 2016

v1.0.0

1.0.0.0 https://github.com/kuborgh/csv-bundle

Converting an array to CSV and vice versa.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Hannes Giesenow

csv library excel array rfc4180