Download the PHP package sassnowski/csv-schema without Composer

On this page you can find all versions of the php package sassnowski/csv-schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package csv-schema

CSV Schema Parser

Build Status Code Climate Scrutinizer Code Quality SensioLabsInsight GitHub license Current Release

Have you ever wanted to have something like an ORM but for CSV files? No? Well now you can!

Introducing CSV Schema Parser. The number one way to turn your boring old CSV files into kick-ass PHP objects. And as if that wasn't amazing enough, it also casts your data to the correct data type! How cool is that? Not very cool you say? Well I disagree!

Installation

Usage

First we have to define the schema of the CSV file we're about to parse. The schema is an associative array where the keys define what properties will be named on the resulting object. The values specify the data type of that column. The schema is ordered, meaning the first entry in the schema will correspond to the first column in the CSV and so on.

After we defined the schema, we can instantiate a new parser from it.

Reading from a string

The parser provides a fromString method that will turn any CSV string into an array of objects. The objects will be structured according to our schema.

Example

Reading from a file

More often than not you will parse your CSV from a file. For this the Parser provides the fromFile method.

Example

Configuration

The configuration array provides a way to overwrite the default settings of the parser. You can set the delimiter, the enclosure character, the escape character and the encoding of the input file.

Available Column Types

You can parse a column to string, float, integer and array.

Parsing arrays

Assuming you have multiple values in a column (sometimes we cannot choose our data...) you might want to parse that column into an array instead. You can do this by specifying array:<delimiter> as the column type in your schema.

Adding custom types

Sometimes you might want a bit more control than the built-in types give you. For instance, you might want to query your database based on an integer in one of your columns and return a model instead. You can easily register arbitrarily complex types by using the static registerType method on the Parser class.

The provided callback receives the column's value and should return its parsed representation.

Adding parameters to custom types

You can add additional parameters to your types by specifying them in the following format in your schema <type>:<parameter>. In this case, the callback function gets passed a second parameter containing the parameter specified in the schema. This allows you to reuse your types instead of defining all sorts of variations of the same type (like querying the database, but using a different table/model).


All versions of csv-schema with dependencies

PHP Build Version
Package Version
Requires tightenco/collect Version ^5.2
league/csv Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sassnowski/csv-schema contains the following files

Loading the files please wait ....