Download the PHP package rhuett/csvie without Composer
On this page you can find all versions of the php package rhuett/csvie. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package csvie
Short Description Csvie is a simple CSV file parser made for Laravel. Csvie is based on LeagueCSV, and can quickly import data to, and export data from, a MySQL database. It also gives you a handy abstract class for quickly sanitizing and scrubbing your CSV files prior to insertion.
License MPL-2.0
Homepage https://github.com/rhuett/csvie
Informations about the package csvie
Csvie
Csvie is a simple CSV file parser made for Laravel 7. Csvie is based on LeagueCSV, and can quickly import data to, and export data from, a MySQL database. It also gives you a handy abstract class for quickly sanitizing and scrubbing your CSV files prior to insertion.
How it works
Csvie is meant to quickly load CSV files with more than a few thousand rows of data into a MySQL database. The idea behind how this works is simple:
- You upload the CSV files onto your server.
- Use Csvie to chunk the files into smaller pieces. Chunking will be done by rows of data, instead of file globs.
- Write a custom CSV scrubber to clean data from the chunked files, then overwrite these files on the server.
- Note that you do not have to use the included HashCsvCleaner implementation. You are free to write your own using the Rhuett\Csvie\Contracts\CsvieCleaner interface.
- Directly load the clean files into your MySQL database directly using the Load Data statement.
Installation
Via Composer:
Make sure to add the following line to your app/config/database.php file:
Once you have finished these configuration changes, don't forget to run:
Note that if you are getting errors about this not being enabled on both the client and server side, then you may also need to edit mysql.cnf:
...and run:
Usage
Single CSV file import example, using a controller's store method:
Making your own Csvie scrubber:
Simply run:
...and you should get a new file that looks like the one below in the App\Services\CsvCleaners directory. Note that the extra comments displayed here will not be included in newly generated files.
Note: If you would like to change the CsvCleaner directory, you can edit the csvie config file in your app's config directory.
Don't forget to add the cleaners directory to your composer.json file (if needed):
Making your own CSV cleaner:
If you want a completely custom CSV Cleaner, then you can make your own implementation based on the Rhuett\Csvie\Contracts\CsvieCleaner contract like so:
Change log
Please see the changelog for more information on what has changed recently.
Testing
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Ryan Huett: Project Author
- LeagueCSV: For making working with CSV's easy
- Laravel Collection Macros: For their succinct filterMap collection macro
License
MPL-2.0. Please see the license file for more information.
All versions of csvie with dependencies
illuminate/support Version ~5|~6|~7
league/csv Version ^9.6
spatie/laravel-collection-macros Version ^6.1