dev-master
9999999-dev https://github.com/windmaomao/laravel-importerscript driven CSV importer for Laravel 4
MIT
The Requires
- illuminate/support 4.2.*
- php >=5.3.0
by Fang Jin
laravel csv import
Wallogit.com
2017 © Pedro Peláez
script driven CSV importer for Laravel 4
Importer can import csv files and map column to fields in database based on config file., (*1)
'customers' => [
'file' => 'customers.csv',
'model' => 'user',
'unique' => 'fullname',
'mapping' => [
'fullname' => 'Full Name',
'email' => 'E-mail',
'created_at' => 'Signup Date',
],
'rules' => [
'fullname' => 'required',
'email' => 'required|email|unique:users',
'username' => 'required',
]
],
'kids' => [
'file' => 'appointments.csv',
'model' => 'kid',
'unique' => 'fullname',
'mapping' => [
'fullname' => 'Kid Name',
'parent_id' => [
'column' => 'Full Name',
'type' => 'reference',
'model' => 'user',
'foreign_ref' => 'id',
'foreign_field' => 'fullname',
'foreign_data' => []
]
],
'rules' => []
],
The idea is that you can just set these settings and then call $importer->import() to get everything imported., (*2)
Add package to the composer.json file, (*3)
"require": {
"qplot/importer": "dev-master"
Then run composer update,, (*4)
composer update
Add provider app/config/app.php file, (*5)
'providers' => array(
'QPlot\Importer\ImporterServiceProvider'
To change settings, you need to first publish config file,, (*6)
php artisan config:publish qplot/importer
script driven CSV importer for Laravel 4
MIT
laravel csv import