Layer for migration from mysql to mysqli.

0.1 2013-11-26 08:29 UTC


Build Status Scrutinizer Quality Score Coverage Status Total Downloads Latest Stable Version Latest Unstable Version

Layer for migration from mysql to mysqli.



For composer documentation, please refer to

php composer.phar require dkplus/mysql-migration-layer


After installing replace all mysql_*() calls with \MySQL\Proxy::*().

You can do this step automatically. Therefore you must also install nikic/php-parser:

php composer.phar require nikic/php-parser

Then you can run the converter by calling:

php vendor/bin/convert-mysql.php [-w] <file>

Run the script with the path of the PHP file you wish to convert as argument. This will print the converted source code to STDOUT.

You can add the -w switch if you want to override the original file with the converted code.

In case of any error, an error message is written to STDERR and the script exits with a return code of 1.

Use find to convert a whole directory recursively:

find <directory> -name "*.php" -exec php "vendor/bin/convert-mysql.php" -w "{}" \;