Download the PHP package alfonsobries/laravel-spreadsheet-importer without Composer

On this page you can find all versions of the php package alfonsobries/laravel-spreadsheet-importer. 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 laravel-spreadsheet-importer

Laravel Faster Spreadsheet Importer

Latest Version on Packagist

This package works together with the xlsx-laravel-spreadsheet-importer CLI tool to quickly import spreadsheets from xlsx files an other compatible formats and then store the values into temporal database tables that are way easier to work with.

Because we use Node instead of PHP we can import larger xlsx files in just a few seconds, and because we will work with a SQL table the operations with the data are considerably faster.

Installation

You can install the package via composer:

You also will need the npm package (check alfonsobries/xlsx-laravel-spreadsheet-importer for more info)

Optionally publish the config files by running:

Configure your model

The files that you will import usually will be associated to one Model, also your Model will be used to store the progress of the import.

Start by adding the InteractsWithImporter trait and the Importable contract to the Model.

You will also need to define the methods in the Importable contract

Add the neccesary columns to the Importable Model

Your Model will need a few columns to store the progress and status of the import, to add those columns you can create a migration like the following (just change the table name for your model table name):

Once the Model is configured and you import a spreadsheet you can interact with the data stored in the temporal table using the tempData() relationship.

For example lets say that your spreadsheet has a sales column and you want the total:

Import a file

For importing a file you will need to call the xlsx-laravel-spreadsheet-importer command using the instructions here but to make your work easy this package includes a StartImport Job that will build the command for you (dont forget to add the neccesary columns to store the progres to your model).

You can dispatch the job at any moment, it receive the importable Model as a param.

For example, you can call the job once you save your model in a store method in a controller (assuming that your model is associating a file and will return a valid file_path in the getFileToImportPath() method):

That job will create and trigger the Node command, then the Node command will call the ReportImporterProgress artisan command every time has some progress to inform, finally the artisan command will trigger a ImporterProgressEvent that you can listen with your custom event listener or by adding ImporterProgressEventListener that comes in this package, that listener is responsible to store the progress of your import into your Model:

To configure the event listener add the following lines into your app/Providers/EventServiceProvider.php:

Testing

For running the tests you will need to install the dependencies and have a valid testing database

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-spreadsheet-importer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2.5
illuminate/support Version ^7.0
symfony/process Version ^5.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 alfonsobries/laravel-spreadsheet-importer contains the following files

Loading the files please wait ....