PHP code example of openbuildings / db-fixtures
1. Go to this page and download the library: Download openbuildings/db-fixtures 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/ */
openbuildings / db-fixtures example snippets
use Openbuildings\DBFixtures\Fixture;
$fixture = new Fixture;
$fixture->connect('mysql:db_name=mydatabase', 'root');
if (file_exists('cache_file.sql'))
{
$fixture->load(file_get_contents('cache_file.sql'));
}
else
{
$fixture
->truncate_all()
->execute_import_files(array('file1.php', 'file2.php'));
file_put_contents('cache_file.sql', $fixture->dump());
}
use Openbuildings\DBFixtures\Fixture;
$fixture = new Fixture;
$fixture->pdo($pdo_object);