PHP code example of desbiger / db-converter

1. Go to this page and download the library: Download desbiger/db-converter 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/ */

    

desbiger / db-converter example snippets



set('memory_limit', '256M');

// Корректные пути
Address\Converter::$sourcePath = __DIR__ . '/import';
Address\Output\Output::$resourcesPath = __DIR__ . '/resources';
Address\Output\Output::$outputPath = __DIR__ . '/output';

// Для загрузки напрямую в базу
$dsn = 'mysql:host=localhost;dbname=database';
$dbUser = 'root';
$dbPass = '';
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8');
$conn = new PDO($dsn, $dbUser, $dbPass, $options);
$output = new Address\Output\MySQL\ConnectionOutput($conn);

// Для дампа в файл
$output = new Address\Output\MySQL\DumpOutput();

Address\Converter::convert($output);