Skip to content

remisauvat/mysqldump-php

Repository files navigation

MySQLDump - PHP

This is a php version of linux's mysqldump in terminal "$ mysqldump -u username -p...".

Build Status Scrutinizer Quality Score Scrutinizer Code Coverage Latest Stable Version

Requirements

  • PHP 5 >= 5.3.0
  • PDO

Getting started

<?php

    use Ifsnop\Mysqldump as IMysqldump;

    $dumpSettings = array(
        'include-tables' => array('table1', 'table2'),
        'exclude-tables' => array('table3', 'table4'),
        'compress' => 'GZIP',
        'no-data' => false,
        'add-drop-database' => false,
        'add-drop-table' => false,
        'single-transaction' => true,
        'lock-tables' => false,
        'add-locks' => true,
        'extended-insert' => true,
        'disable-foreign-keys-check' => false,
        'where' => '',
        'no-create-info' => false
    );

    $dump = new IMysqldump\Mysqldump('clouddueling', 'root', 'password', 'localhost', 'mysql', $dumpSettings);
    $dump->start('storage/work/dump.sql');

API

Composer

"ifsnop/mysqldump-php": "dev-master"

or

"ifsnop/mysqldump-php": "1.0.*"

Todo

  • Write unit tests.
  • Refactor into one class.

Contributing

Format all code to PHP-FIG standards. http://www.php-fig.org/

License

This project is open-sourced software licensed under the MIT license

Credits

Originally based on James Elliott's script from 2009. http://code.google.com/p/db-mysqldump/

About

PHP version of mysqldump cli that comes with MySQL

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 81.1%
  • Shell 10.0%
  • PLpgSQL 8.9%