Installation

Require this package in your composer.json and update composer. This will download the package and PHPExcel of PHPOffice.

Laravel 4

"maatwebsite/excel": "~1.3"

Laravel 5

"maatwebsite/excel": "~2.1.0"

After updating composer, add the ServiceProvider to the providers array in app/config/app.php

Maatwebsite\Excel\ExcelServiceProvider::class,

You can use the facade for shorter code. Add this to your aliasses:

'Excel' => Maatwebsite\Excel\Facades\Excel::class,

The class is binded to the ioC as excel

$excel = App::make('excel');

Config

Laravel 4

Laravel Excel includes several config settings for import-, export-, view- and CSV-specific settings. Use the artisan publish command to publish the config file to your project.

php artisan config:publish maatwebsite/excel

The config files can now be found at app/config/packages/maatwebsite/excel

Laravel 5

To publish the config settings in Laravel 5 use:

php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider"

This will add an excel.php config file to your config folder.

Requirements

  • PHP version >= 5.3.7
  • Laravel >= 4.1
  • PHPOffice PHPExcel >= 1.8.0 (included by composer.json)
  • PHP extension php_zip enabled (required if you need PHPExcel to handle .xlsx .ods or .gnumeric files)
  • PHP extension php_xml enabled
  • PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)

Contribution Guide

Bug fixes

ALL bug fixes should be made to appropriate branch (e.g. 1.1 for 1.1.* bug fixes). Bug fixes should never be sent to the master branch.

Pull Requests

Every pull request should pass the unit tests. If you include new functionality, make sure you include a test. Pull requests will be evaluated and possibly added to the next stable release.

Feature Requests

If you have an idea for a new feature you would like to see added to Laravel Excel, you may create an issue on GitHub with [Request] in the title. The feature request will then be reviewed by @Maatwebsite.

Coding Guidelines

Laravel, and therefore Maatwebsite's Laravel Excel follows the PSR-0 and PSR-1 coding standards. In addition to these standards, below is a list of other coding standards that should be followed:

  • Namespace declarations should be on the same line as <?php.
  • Class opening { should be on the same line as the class name.
  • Function and control structure opening { should be on a separate line.
  • Interface and Trait names are suffixed with Interface (FooInterface) and Trait (FooTrait) respectively.

License

This package is licensed under LGPL. You are free to use it in personal and commercial projects. The code can be forked and modified, but the original copyright author should always be included!