2017 © Pedro Peláez
 

library csv

Powerful tool for csv files

image

stdakov/csv

Powerful tool for csv files

  • Wednesday, May 18, 2016
  • by stdakov
  • Repository
  • 1 Watchers
  • 0 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

CSV tool

This is a very powerful tool for reading, creating, updating or downloading a csv file. Also you can read file from the end., (*1)

Installation

The preferred way to install this tool is through composer., (*2)

Either run, (*3)

php composer.phar require stdakov/csv

or add, (*4)

"stdakov/csv": "*"

Usage

require 'vendor/autoload.php';

Optional: if you want you can use custom filename. It there is no custom filename it will create file with name date("Y-m-d_H:i:s") . '_' . export.csv, (*5)

$file = 'export.csv'; //It is optional

Also you can show in witch folder file will be saved., (*6)

$path = 'somePath'; //It is optional

Create instance, (*7)

$csv = new \Dakov\CSV();

or with custom file and path, (*8)

$csv = new \Dakov\CSV($path);
$csv->setFile($file);

Example data for insert:, (*9)

$data = [
    [
        'column1' => 1,
        'column2' => 1,
    ],
    [
        'column1' => 2,
        'column2' => 2,
    ],
];

Insert and create file with data, (*10)

$csv->create($data);

Example data for append:, (*11)

$data = [
    [
        'column1' => 3,
        'column2' => 3,
    ],
    [
        'column1' => 4,
        'column2' => 4,
    ],
    [
        'column1' => 5,
        'column2' => 5,
    ],
];

Append some data to the file:, (*12)

$csv->append($data);

Return assoc array with all data:, (*13)

print_r($csv->read());

Return assoc array with all reverse data:, (*14)

print_r($csv->readReverse());

You can set line limit (it is optional), (*15)

print_r($csv->readReverse(2));

Download file, (*16)

$csv->download();

also you can delete file after download, (*17)

$csv->download(true);

The MIT License (MIT), (*18)

The Versions

18/05 2016

dev-master

9999999-dev

Powerful tool for csv files

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Stanislav Dakov

csv read write export download import

18/05 2016

v1.0

1.0.0.0

Powerful tool for csv files

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Stanislav Dakov

csv read write export download import