Skip to content

A simple PHP library used to format data into comma-separated values (CSV)

License

Notifications You must be signed in to change notification settings

SyntaxSolutions/csvbuilder-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSV Builder for PHP

A simple PHP library used to format data into comma-separated values (CSV).

Features

  1. RFC 4180 standard compliant
  2. UTF-8 encoded.
  3. Excel compatible.

Installation

composer require syntaxsolutions/csvbuilder

Example

<?php
// Load Composer's autoloader
require 'vendor/autoload.php';

use SyntaxSolutions\CsvBuilder;
use SyntaxSolutions\CsvRow;

$builder = new CsvBuilder();

$headers = new CsvRow();
$headers->addCell("Header 1");
$headers->addCell("Header 2");
$headers->addCell("Header 3");
$builder->addHeaders($headers);

$row = new CsvRow();
$row->addCell("Cell 1");
$row->addCell("Cell 2");
$row->addCell("Cell 3");
$builder->addRow($row);

echo $builder->getBytes();

About

A simple PHP library used to format data into comma-separated values (CSV)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages