Contact Us

New milestone: 20 million downloads for Laravel Excel | by Patrick Brouwers | Maatwebsite | Medium

Mobile App | March 28, 2021

We are happy to have reached this milestone and thank you all for using our package over the last 6,5 years! Cheers to many more imports and exports!

Laravel Excel 3.1.20

In other news, we have released Laravel Excel 3.1.20 with some improvements for running imports on Vapor and working with row numbers, along with some fixes and changes. You can find a write up about this new release here.

New features

Re-sycing remote temporary file

When dealing with a multi server setup (and thus using a remote temporary file), it’s possible for the clean up that occurs after entire queue has been run to only cleanup the server that the last AfterImportJob runs on. The rest of the server would still have the local temporary file stored on it. In this case your local storage limits can be exceeded and future imports won’t be processed (This is especially an issue with Vapor).

To mitigate this you can set the new config settings (force_resync_remote) to true. After every queued chunk the local temporary file will be deleted on the server that processed it. Without this setting it will only happen at the end of the process.

Remember row number

A new trait was added that helps keeping track of the current row number. This can be especially useful when dealing with the ToModel concern. You can get the current row number by using the `$this->rowNumber` property.

Remember chunk offset

In additional to the row number trait also a chunk offset trait was added. It keeps track of the start row of the current chunk. This can be especially helpful when dealing with Chunked Imports.

WithColumnLimit concern

Another addition is the WithColumnFilter concern, it allows to specify an end column. This can be useful if you only want to read a very specific range of columns.

WithReadFilter concern

Behind the scenes read filters are used for chunk reading and the row limit concern. In some cases you might want to filter or skip rows yourself. You can do now by implementing the WithReadFilter concern.

In your export:

Publishing the stubs

It’s now possible to publish the stubs that are used when using the php artisan make:import and php artisan make:export commands so you can change them to your liking.

php artisan stub:publish (Laravel 7.x)

The InteractsWithQueue trait was added to the ReadChunk job. The trait allows for the job to be released back onto the queue, useful for instance if using it with the funnel or throttle methods on the Redis facade.

Retry until and middleware on queued imports

It’s possible to specify a retry until method and add middleware to the import:

More about job middleware can be found in the Laravel documentation: https://laravel.com/docs/7.x/queues#job-middleware

Using WithValidation with FromCollection & FromArray

This release also added support for combining those concerns and works in a similar fashion as for Model imports.

Read filters for WithLimit and HeadingRowImport

WithLimit concern and HeadingRowImport now use read filter, which means it will now only read the necessary rows.

Bump of minimum version PhpSpreadsheet

The minimum version of PhpSpreadsheet was bumped to 1.14.

Read more about the package at: https://laravel-excel.com/

Don’t forget to send us a postcard of your hometown if you use Laravel Excel. We love to receive them!

Maatwebsite
Markt 2
6231 LS Meerssen
The Netherlands

This content was originally published here.