PHP code example of eugabrielsilva / sql-dumper

1. Go to this page and download the library: Download eugabrielsilva/sql-dumper 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/ */

    

eugabrielsilva / sql-dumper example snippets


// Include Composer packages if not yet
 \GabrielSilva\SQLDumper\SQLDumper();

// Set your server settings (optional)
$db->host = 'localhost';
$db->user = 'root';
$db->password = '';
$db->db = 'app';

// Generate dump to an SQL file
$db->dumpToFile('backup.sql');

// You can also dump to a string
$dump = $db->dumpToString();

$db->host = 'localhost'; // Server hostname
$db->user = 'root'; // Username to connect to the database
$db->password = ''; // User password
$db->db = 'app'; // Database name
$db->port = 3306; // Server port
$db->charset = 'utf8'; // Database charset
$db->ements in dump
$db->dropDatabase = false; // Include DROP DATABASE statement in dump
$db->insertData = true; // Include data in dump
$db->deleteData = false; // Delete data from table before inserting
$db->insertType = 'INSERT'; // Insert type: INSERT, INSERT IGNORE or REPLACE
$db->safeMode = true; // Use IF EXISTS and IF NOT EXISTS clauses in dump
$db->chunkSize = 3000; // Number of rows to fetch per query (useful in large tables)