Skip to content

svenkuegler/php-csv-validator

Repository files navigation

PHP CSV Validator

Build Status Code Climate Test Coverage

Simple PHP Class to Validate CSV Files

Installation

via Composer:

composer require svenkuegler/php-csv-validator

Usage

Quick Start

Simple example to validate a file against a Schema.

require 'vendor/autoload.php';

$validator = new PhpCsvValidator();
$validator->loadSchemeFromFile("tests/files/example-scheme2.json");

if($validator->isValidFile("tests/files/example.csv")) {
    echo "File is Valid";
} else {
    echo "File is Invalid!";
}

Schema

...

Exception handling

...

Running Tests

$ phpunit

Contributing

Feel free to send pull requests or create issues if you come across problems or have great ideas. Any input is appreciated!

License

This code is published under the The MIT License. This means you can do almost anything with it, as long as the copyright notice and the accompanying license file is left intact.