PHPackages                             openbuildings/db-fixtures - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. openbuildings/db-fixtures

ActiveLibrary[Database &amp; ORM](/categories/database)

openbuildings/db-fixtures
=========================

Load data into the database and cache with raw sql inserts

0.4.0(6y ago)1125.8k11BSD-3-ClausePHPPHP ^7.1CI failing

Since Jul 26Pushed 6y ago12 watchersCompare

[ Source](https://github.com/OpenBuildings/db-fixtures)[ Packagist](https://packagist.org/packages/openbuildings/db-fixtures)[ RSS](/packages/openbuildings-db-fixtures/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (1)

DB Fixtures [![Build Status](https://camo.githubusercontent.com/deb7589ead7ee7bbf747aee0d1611d07954b9c7a331085f70687958efc1080d4/68747470733a2f2f7472617669732d63692e6f72672f4f70656e4275696c64696e67732f64622d66697874757265732e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/OpenBuildings/db-fixtures) [![Coverage Status](https://camo.githubusercontent.com/5e19194a337e5630d6009d1793fb2479d519bd220b3b7f37fc50338dab07a28b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f4f70656e4275696c64696e67732f64622d66697874757265732f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/OpenBuildings/db-fixtures?branch=master)
=========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#db-fixtures--)

This package gives you an abilitiy to keep database fixtures in plain php files and then store a snapshot of the database's content as raw sql queries. This allaws for readable fixture files (as opposed to xml or yml dumps) and you could use your ORM of choise and take advantage of all of your associations.

Here's an example usage:

```
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());
}
```

`file1.php` and `file2.php` are simple php scripts where you do whatever you want to put data inside your database, then `dump()` will return it as raw SQL inserts.

It does not use mysqldump so it is more portable.

If you want you could pass the actual Pdo connection object and reuse it from your own configuration like this:

```
use Openbuildings\DBFixtures\Fixture;

$fixture = new Fixture;
$fixture->pdo($pdo_object);
```

The actual file caching is not part of this package as most frameworks have their own cache functionality and it would be better to use that instead of rolling out our own.

License
-------

[](#license)

Copyright (c) 2012-2013, OpenBuildings Ltd. Developed by Ivan Kerin as part of [clippings.com](http://clippings.com)

Under BSD-3-Clause license, read LICENSE file.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~402 days

Recently: every ~603 days

Total

7

Last Release

2260d ago

PHP version history (2 changes)0.2.2PHP &gt;=5.3.2

0.4.0PHP ^7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/506129?v=4)[Harry Dobrev](/maintainers/hkdobrev)[@hkdobrev](https://github.com/hkdobrev)

![](https://avatars.githubusercontent.com/u/4113307?v=4)[Danail Kyosev](/maintainers/dkyosev)[@dkyosev](https://github.com/dkyosev)

![](https://avatars.githubusercontent.com/u/7592650?v=4)[Evstati Zarkov](/maintainers/EZarkov)[@EZarkov](https://github.com/EZarkov)

![](https://avatars.githubusercontent.com/u/745771?v=4)[Filip Georgiev](/maintainers/phgeorgiev)[@phgeorgiev](https://github.com/phgeorgiev)

![](https://avatars.githubusercontent.com/u/490439?v=4)[Zdravko Evstatiev](/maintainers/zedevs)[@zedevs](https://github.com/zedevs)

---

Top Contributors

[![hkdobrev](https://avatars.githubusercontent.com/u/506129?v=4)](https://github.com/hkdobrev "hkdobrev (5 commits)")[![tumbalev](https://avatars.githubusercontent.com/u/28398671?v=4)](https://github.com/tumbalev "tumbalev (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/openbuildings-db-fixtures/health.svg)

```
[![Health](https://phpackages.com/badges/openbuildings-db-fixtures/health.svg)](https://phpackages.com/packages/openbuildings-db-fixtures)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M545](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
