Download the PHP package ifsnop/mysqldump-php without Composer
On this page you can find all versions of the php package ifsnop/mysqldump-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
More information about ifsnop/mysqldump-php
Files in ifsnop/mysqldump-php
Rated 4.00 based on 1 reviews
Informations about the package mysqldump-php
MySQLDump - PHP
This is a php version of mysqldump cli that comes with MySQL, without dependencies, output compression and sane defaults.
Out of the box, MySQLDump-PHP supports backing up table structures, the data itself, views, triggers and events.
MySQLDump-PHP is the only library that supports:
- output binary blobs as hex.
- resolves view dependencies (using Stand-In tables).
- output compared against original mysqldump. Linked to travis-ci testing system (testing from php 5.3 to 7.3 & hhvm)
- dumps stored routines (functions and procedures).
- dumps events.
- does extended-insert and/or complete-insert.
- supports virtual columns from MySQL 5.7.
- does insert-ignore, like a REPLACE but ignoring errors if a duplicate key exists.
- modifying data from database on-the-fly when dumping, using hooks.
- can save directly to google cloud storage over a compressed stream wrapper (GZIPSTREAM).
From version 2.0, connections to database are made using the standard DSN, documented in PDO connection string.
- PHP 5.3.0 or newer
- MySQL 4.1.0 or newer
Using Curl to always download and decompress the latest release:
Plain old PHP:
Refer to the wiki for some examples and a comparision between mysqldump and mysqldump-php dumps.
Changing values when exporting
You can register a callable that will be used to transform values during the export. An example use-case for this is removing sensitive data from database dumps:
Getting information about the dump
You can register a callable that will be used to report on the progress of the dump
Table specific export conditions
You can register table specific 'where' clauses to limit data on a per table basis. These override the default
where dump setting:
Table specific export limits
You can register table specific 'limits' to limit the returned rows on a per table basis:
Constructor and default parameters
- Only include these tables (array of table names), include all if empty.
- Exclude these tables (array of table names), include all if empty, supports regexps.
- Only include these views (array of view names), include all if empty. By default, all views named as the include-tables array are included.
- Only create a new table when a table of the same name does not already exist. No error message is thrown if the table already exists.
- Gzip, Bzip2, None.
- Could be specified using the declared consts: IMysqldump\Mysqldump::GZIP, IMysqldump\Mysqldump::BZIP2 or IMysqldump\Mysqldump::NONE
- Removes the AUTO_INCREMENT option from the database definition
- Useful when used with no-data, so when db is recreated, it will start from 1 instead of using an old value
- utf8 (default, compatible option), utf8mb4 (for full utf8 compliance)
- Could be specified using the declared consts: IMysqldump\Mysqldump::UTF8 or IMysqldump\Mysqldump::UTF8MB4BZIP2
- Option to disable autocommit (faster inserts, no problems with index keys)
- Do not dump data for these tables (array of table names), support regexps,
trueto ignore all tables
The following options are now enabled by default, and there is no way to disable them since they should always be used.
To dump a database, you need the following privileges :
- In order to dump table structures and data.
- SHOW VIEW
- If any databases has views, else you will get an error.
- If any table has one or more triggers.
- LOCK TABLES
- If "lock tables" option was enabled.
Use SHOW GRANTS FOR [email protected]; to know what privileges user has. See the following link for more information:
Current code for testing is an ugly hack. Probably there are much better ways of doing them using PHPUnit, so PR's are welcomed. The testing script creates and populates a database using all possible datatypes. Then it exports it using both mysqldump-php and mysqldump, and compares the output. Only if it is identical tests are OK. After this commit, some test are performed using phpunit.
Some tests are skipped if mysql server doesn't support them.
A couple of tests are only comparing between original sql code and mysqldump-php generated sql, because some options are not available in mysqldump.
Bugs (from mysqldump, not from mysqldump-php)
After this bug report, a new one has been introduced. _binary is appended also when hex-blob option is used, if the value is empty.
mysqldump-php is not backwards compatible with php 5.2 because we it uses namespaces. However, it could be trivially fixed if needed.
Write more tests, test with mariadb also.
Format all code to PHP-FIG standards. https://www.php-fig.org/
This project is open-sourced software licensed under the GPL license
After more than 8 years, there is barely anything left from the original source code, but:
Originally based on James Elliott's script from 2009. https://code.google.com/archive/p/db-mysqldump/
Adapted and extended by Michael J. Calkins. https://github.com/clouddueling
Currently maintained, developed and improved by Diego Torres. https://github.com/ifsnop