mpeter-php / phpmig-mysqli-adapter
An adapter for phpmig which provides database access via mysqli
Installs: 8 431
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >5.3
- davedevelopment/phpmig: ^1.6
This package is auto-updated.
Last update: 2025-03-09 04:31:33 UTC
README
A Phpmig MySQLi Adapter
Getting started
$ php composer.phar require mpeter-php/phpmig-mysqli-adapter
Examples
Non-CLI example
<?php require_once('vendor/autoload.php'); use Phpmig\Adapter\MysqlIAdapter; use Phpmig\Api\PhpmigApplication; use Symfony\Component\Console\Output\NullOutput; $mysqli = new mysqli('db_host', 'db_user', 'db_pass', 'my_database'); (new PhpmigApplication( new ArrayObject( [ 'phpmig.migrations_path' => __DIR__ . DIRECTORY_SEPARATOR . 'migrations', 'phpmig.adapter' => new MysqlIAdapter($mysqli, 'migrations'), 'db' => $mysqli ] ), new NullOutput() ))->up();
CLI Example
<?php /** * phpmig.php */ use Phpmig\Adapter; $mysqli = new mysqli('db_host', 'db_user', 'db_pass', 'my_database'); return new ArrayObject( [ [ 'phpmig.migrations_path' => __DIR__ . DIRECTORY_SEPARATOR . 'migrations', 'phpmig.adapter' => new Adapter\MysqlIAdapter($mysqli, 'migrations'), 'db' => $mysqli ] ] );