Download the PHP package jhesyong/simple-excel-parser without Composer

On this page you can find all versions of the php package jhesyong/simple-excel-parser. 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 simple-excel-parser

Simple Excel Parser

A simple excel parser that parses each row to an associative array.

When to use this?

Example

You want to parse an excel file with the following format.

Name Age Gender Phone 1 Phone 2
Bill 18 Male 222-222-2222 777-777-7777
Peter 25 Male 222-333-4444 555-666-7777
Monica 31 Female 666-666-6666 555-555-5555

And you want to map the header titles to database table fields, and map genders to 'm' or 'f'.

$parser = new Jhesyong\Excel\Parser;

// Map 'Name' to 'name', 'Age' to 'age', and 'Gender' to 'gender'.
$parser->addHeader('Name', 'name');
$parser->addHeader('Age', 'age');

// Map the values: 'm' is for 'Male', and 'f' is for 'Female'
$parser->addHeader('Gender', 'gender')->withOptions(['m' => 'Male', 'f' => 'Female']);

// You can use a regular expression and pass a callback to map multiple header titles.
// In this case, 'Phone 1' will be mapped to 'phone_1'
$parser->addHeader('/^Phone \d+$/', function($title)
{
    return str_replace(' ', '_', strtolower($title));
});

// Load the file and start to parse. Pass a callback function
// and it will be called for each row.
$parser->loadFile('filename.xlsx')->parse(function($data)
{
    // Data will be an associative array.
    var_dump($data);
});

FAQ

I have multiple titles of the same text, but I want to map them to different database table fields.

You can add headers with the same title but different field names in the desired order.

// The first 'Phone' will be mapped to 'phone_1',
// and the second 'Phone' will be mapped to 'phone_2'
$parser->addHeader('Phone', 'phone_1');
$parser->addHeader('Phone', 'phone_2');

I just want to use the title as the field name

You can omit the second argument.

// 'Phone' will be mapped to 'Phone'
$parser->addHeader('Phone');

I want to pre-define the header mapping and the options.

You can extend the Parser and write your rules in the constructor.


All versions of simple-excel-parser with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
phpoffice/phpexcel Version 1.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 jhesyong/simple-excel-parser contains the following files

Loading the files please wait ....