imag/csv-bundle

Create and manage your CSV

v1.0.2 2016-08-03 09:49 UTC

This package is auto-updated.

Last update: 2024-11-28 04:35:45 UTC


README

Manage your csv with this bundle.

Install

  1. Download CsvBundle
  2. Enable the bundle

How get the bundle

Composer

Modify your composer.json on your project root

// {root}/composer.json

{
    [...],
    "require": {
        [...],
        "imag/csv-bundle": "dev-master"
    }
}

Enable the Bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
    // ...
    new IMAG\CsvBundle\IMAGCsvBundle(),
    );
}

Usage

Create a Csv

<?php

// Init the manager
$manager = $this->get('imag_csv.manager.csv');
$manager
    ->setFilename('/tmp/test.csv')
    ->setDelimiter(',')
    ->setEnclosure('"')
    ;

// Create a row on Csv
$row = $manager->createRow();
$row
    ->addField('1')
    ->addField('2')
    ;
$manager->addRow($row);

// Write Csv
$manager->write();