Download the PHP package coderflex/laravel-csv without Composer
On this page you can find all versions of the php package coderflex/laravel-csv. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download coderflex/laravel-csv
More information about coderflex/laravel-csv
Files in coderflex/laravel-csv
Package laravel-csv
Short Description A Laravel livewire CSV Importer, to handle importing millions of rows without a hustle.
License MIT
Homepage https://github.com/coderflex/laravel-csv
Informations about the package laravel-csv
- Introduction
- Installation
- Configuration
- Usage
- CSV Importer Component
- Button Component
- In TALL stack project
- In none TALL Stack project
- Using Queues
- Testing
- Changelog
- Contributing
- Security Vulnerabilities
- Inspiration
- Credits
- License
Introduction
Laravel CSV Package is a package created on top of Laravel livewire for easily handling imports with a simple API.
Installation
You can install the package via composer:
Configuration
Publish and run the migrations with:
Add trait HasCsvImports to your User model.
Publish the config file with:
The following is the contents of the published config file:
The layout
option is for choosing which CSS framework you are using and currently supports only tailwindcss
. We are working on other CSS frameworks to implement in the future.
The file_upload_size
is for validation rules, and it defines the maximum file size of uploaded files. You may also define this value from the livewire config file.
Optionally, you can publish the views using
Before Using this command, please take a look at this section below.
Usage
CSV Importer Component
Using this package is a breeze. To implement the importer in your project, simply include the following component inside a Blade view.
Props | Type | Description |
---|---|---|
model | string |
Fully qualified name of the model you wish to import to |
columns-to-map | array |
Column names in the target database table |
required-columns | array |
Columns that are required by validation for import |
columns-label | array |
Display labels for the required columns |
Button Component
The Component uses alpinejs
under the hood. To display an import button, include the x-csv-button
component.
To style the button, use the class
attribute with Tailwind utility classes.
In TALL stack project
If you are using this package in a TALL Stack project, (Tailwindcss, Alpinejs, Laravel, Livewire) publish the vendor views to include Laravel-CSV in your project.
Then compile your assets.
In none TALL Stack project
If you are not using the TALL Stack, use the csv directives
to add the necessary styles/scripts.
Using Queues
This package uses queues under the hood with PHP Generators to make it fast and efficient.
Create the batches table
by running
Then, run the migration.
After that, set up the queues' configuration. Head to Laravel Queues Documentation to learn more.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Inspiration
This Package Was Inspired by codecourse video series. If you want to learn how this package was created, make sure to take a look at this video series
Credits
- ousid
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-csv with dependencies
illuminate/contracts Version ^9.0|^10.0
league/csv Version ^9.8
livewire/livewire Version ^2.10
spatie/laravel-package-tools Version ^1.9.2