1. Go to this page and download the library: Download mauretto78/db-importer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mauretto78 / db-importer example snippets
use DbImporter\Importer;
// init Importer
$importer = Importer::init(
$connection, // your DBAL connection
$table, // table to import data
$mapping, // mapping array
$data, // input data
$ignoreErr, // ignore errors (boolean). True is default value
$mode // insert mode. 'single' or 'multiple' are the only values allowed. 'multiple' is default value
);
// execute import query
$importer->execute()
$mapping = [
'id' => 'id_utente', // 'id' is the column name on your database's table. 'id_utente' is the key in input data
'name' => 'name_utente', // 'name' is the column name on your database's table. 'name_utente' is the key in input data
'username' => 'username_utente', // 'username' is the column name on your database's table. 'username_utente' is the key in input data
'email' => 'email_utente', // 'email' is the column name on your database's table. 'email_utente' is the key in input data
];