Download the PHP package mauretto78/db-importer without Composer
On this page you can find all versions of the php package mauretto78/db-importer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mauretto78/db-importer
More information about mauretto78/db-importer
Files in mauretto78/db-importer
Package db-importer
Short Description In Memory List
License MIT
Homepage https://github.com/mauretto78/db-importer
Informations about the package db-importer
Db-Importer
This library allows you to import data in your database with very low effort.
Basic Usage
To use Importer simply do this:
Please note that you must pass a DBAL Connection instance to Importer class.
Avaliable drivers
Currently the supported drivers are:
pdo_mysql
(MySQL)pdo_pgsql
(PostgreSQL)pdo_sqlite
(Sqlite)
Mapping array
The mapping array is a simple key value array in which you specify the column name on your database's table and the corresponding key in the input data. Look at the following example:
Data
The only requirement is the input data must be iterable (array or object). Here's the most simple example:
Working with Entities
You can use as your feed data an iterable object of entities. Getters are required. Look at the following example:
Insert Mode (multiple or single)
You can decide how to build insert query:
- 'multiple' (default) - insert data in a unique multiple insert query
- 'single' - insert data in a loop of insert queries
Limit of records in multiple insert queries
Please note that there is a limit to the maximum number of records that can be inserted in a single query. In case this limit is exceeded, a loop of multiple insertion queries will be executed.
This limit is:
- 4000 records for
pdo_mysql
driver - 4000 records for
pdo_pgsql
driver - 200 records for
pdo_sqlite
driver
Create Schema
If you need to create table scheme, use createSchema()
method. Do the following:
Destroy Schema
To destroy table scheme, use destroySchema()
method:
Clear data table
If you want to clear table data (maybe before importing data), use clearData()
method instead:
Built With
- DBAL - Database Abstraction Layer
Requirements
- PHP 5.6+
- MySQL 5.7+
- PostgreSQL 9.5+
Support
If you found an issue or had an idea please refer to this section.
Authors
- Mauro Cassani - github
License
This project is licensed under the MIT License - see the LICENSE.md file for details
All versions of db-importer with dependencies
doctrine/dbal Version ^2.6
symfony/property-access Version ^4.0
symfony/serializer Version ^4.0