urukalo / csvimporter
csv importer
Installs: 3 692
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- league/csv: 8.0.0
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2024-05-11 16:50:57 UTC
README
simple importer from csv file to mysql database
Getting Started
add with composer make folder with cvs files (one file by database)
look down at usage example
Usage
here is one example for usage in laravel seeder
$connection = new PDO('mysql:host=127.0.0.1;dbname=my_db;charset=utf8', 'my_user', 'my_pass', array(
PDO::ATTR_PERSISTENT => true
));
$csvPath = __DIR__."/csv/";
$importer = new csvImporter($connection, $csvPath);
$configs = [
[
'table' => 'table_name',
'fields' => [
'CSV_ID' => 'table_id',
'CreatedDate' => 'created_at',
'ModifiedDate' => 'updated_at',
'Website' => 'website',
'FaceBook' => 'facebook',
'Twitter' => 'twitter',
'Instagram' => 'instagram',
'ModifiedBy' => 'modified_by',
'Enabled' => 'enabled'
],
'file' => 'file_name.csv',
]
];
echo $importer->run($configs);
Running the tests
Explain how to run the automated tests for this system
Break down into end to end tests
Explain what these tests test and why
Give an example
And coding style tests
Explain what these tests test and why
Give an example
Deployment
Add additional notes about how to deploy this on a live system
Built With
- Dropwizard - Bla bla bla
- Maven - Maybe
- Atom - ergaerga
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Milan Urukalo - Initial work - PurpleBooth
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Hat tip to anyone who's code was used
- Inspiration
- etc