PHPackages                             linkorb/transmogrifier - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. linkorb/transmogrifier

ActiveLibrary[Testing &amp; Quality](/categories/testing)

linkorb/transmogrifier
======================

Fixture library and commmand-line tools

v1.1.0(11y ago)71202PHPCI failing

Since Feb 26Pushed 11y ago10 watchersCompare

[ Source](https://github.com/linkorb/transmogrifier)[ Packagist](https://packagist.org/packages/linkorb/transmogrifier)[ Docs](http://www.github.com/linkorb/transmogrifier)[ RSS](/packages/linkorb-transmogrifier/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

Transmogrifier
==============

[](#transmogrifier)

[![](https://camo.githubusercontent.com/c42124be57bbdbddd39128d209176dfbb138b8854d5c59821b0f25836f5e8bd4/687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6f6e6c696e652f6c696e6b6f72622f75706c6f61642f7472616e736d6f677269666965722e676966)](https://camo.githubusercontent.com/c42124be57bbdbddd39128d209176dfbb138b8854d5c59821b0f25836f5e8bd4/687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6f6e6c696e652f6c696e6b6f72622f75706c6f61642f7472616e736d6f677269666965722e676966)

Transmogrifier is a tool to help setup your database fixtures before running your tests.

You can use it in the following ways:

1. As a simple command-line utility (great for your build scripts and continuous integration)
2. As a PHP library
3. As a Behat extension, enabling Gherkin statements for automated BDD database testing

1. Command-line utility
-----------------------

[](#1-command-line-utility)

You can use Transmogrifier as a command-line utility (stand-alone, or as part of your PHP project through composer).

### Standalone

[](#standalone)

1. clone this git repository
2. run `composer install` to install all dependencies
3. run `bin/transmogrifier --help` for a list of available commands

### Through composer, in your PHP project:

[](#through-composer-in-your-php-project)

Open your `composer.json` file, and add this to the `require` section:

```
"linkorb/transmogrifier": "dev-master"
```

You can now run `vendor/bin/transmogrifier`.

### Adding transmogrifier commands to an existing Symfony/Console application

[](#adding-transmogrifier-commands-to-an-existing-symfonyconsole-application)

Add the following line to an existing Symfony/Console application in order to enable the Transmogrifier commands to it:

```
$application->add(new \LinkORB\Transmogrifier\Command\DatasetApplyCommand());
```

### Available commands

[](#available-commands)

#### transmogrifier:datasetapply

[](#transmogrifierdatasetapply)

The most interesting usage through the command-line is the `transmogrifier:applydataset` command.

You can use it like this:

```
bin/transmogrifier transmogrifier:applydataset --dbname=test example/user.yml

```

This command will ensure that the `dbname` database contains the dataset specified in `example/user.yml`

2. PHP Library
--------------

[](#2-php-library)

You can use the Transmogrifier very easily from within your own PHP projects as a library.

### Installing the library through composer

[](#installing-the-library-through-composer)

pen your `composer.json` file, and add this to the `require` section:

```
"linkorb/transmogrifier": "dev-master"
```

### How to use the library

[](#how-to-use-the-library)

The 2 main classes are:

- `Dataset`: A class that can load datasets from files, and apply them to databases.
- `Database`: A connection to a database, providing helpers for initializing the connection.

Here's an example usage:

```
$db = new Database();
// Optionally initialize db parameters by file, cli options, or explicit values
$db->parseConf('/path/to/my/dbconf/test.conf');
$db->connect();

$dataset = new Dataset();
$dataset->loadDatasetFile('/path/to/my/dataset.yml');
$dataset->applyTo($db);
```

3. Behat Extension
------------------

[](#3-behat-extension)

There is a Transmogrifier Extension available for Behat!

This allows you to use Transmogrifier directly from your Behat .feature files.

Check out the extension and it's documentation here:

-

Supported file-formats
----------------------

[](#supported-file-formats)

The dataset importer is based on phpunit/dbunit. It currently supports the following file-formats:

- YAML
- Flat XML
- XML
- CSV

The Dataset loader guesses the format based on the file-extension.

Please refer to the `example/` directory for datasets in these formats. The PHPUnit documentation contains further information about the loaders:

- [PHPUnit DBUnit documentation](http://phpunit.de/manual/current/en/database.html)

Database .conf files
--------------------

[](#database-conf-files)

To simplify connecting to your database, Transmogrify can load conneciton settings from a simple `.conf` file.

An example file looks like this:

```
name=test
server=127.0.0.1
username=susie
password=mrbun
driver=mysql
```

You can use these `.conf` files in all Transmogrifier modes: Command-line, Behat, or library. The connection is established through `PDO`, so all PDO supported databases will work.

Example datasets
----------------

[](#example-datasets)

The `examples/` directory contains a few datasets you can use to try out Transmogrifier, see how it works, and copy as a starting-point for your own datasets.

### Create the schema

[](#create-the-schema)

The examples will ensure 2 users, 'Calvin' and 'Hobbes', are registed in your `user` table.

Before you can try these out, use the following SQL to generate the `user` table in your `test` database:

```
CREATE TABLE user (id int, name varchar(16), email varchar(32), password varchar(32));
```

Brought to you by the LinkORB Engineering team
----------------------------------------------

[](#brought-to-you-by-the-linkorb-engineering-team)

[![](https://camo.githubusercontent.com/62fb66b034de7ea7fca9fd9776424b5348daa76ef8622caf92c2f7622003e5ef/687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6d6574612f74696572312f696d616765732f6c696e6b6f7262656e67696e656572696e672d6c6f676f2e706e67)](https://camo.githubusercontent.com/62fb66b034de7ea7fca9fd9776424b5348daa76ef8622caf92c2f7622003e5ef/687474703a2f2f7777772e6c696e6b6f72622e636f6d2f642f6d6574612f74696572312f696d616765732f6c696e6b6f7262656e67696e656572696e672d6c6f676f2e706e67)
Check out our other projects at [linkorb.com/engineering](http://www.linkorb.com/engineering).

Btw, we're hiring!

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 82.4% 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 ~3 days

Total

2

Last Release

4087d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1db66b320db18b8036ea68211b7d8a39e7c6da97e6fd29f59a50380ebb69d0bb?d=identicon)[joostfaassen](/maintainers/joostfaassen)

---

Top Contributors

[![joostfaassen](https://avatars.githubusercontent.com/u/411113?v=4)](https://github.com/joostfaassen "joostfaassen (14 commits)")[![congpeijun](https://avatars.githubusercontent.com/u/881552?v=4)](https://github.com/congpeijun "congpeijun (3 commits)")

---

Tags

phptestingFixturedatabasetransmogrifier

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/linkorb-transmogrifier/health.svg)

```
[![Health](https://phpackages.com/badges/linkorb-transmogrifier/health.svg)](https://phpackages.com/packages/linkorb-transmogrifier)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)[robiningelbrecht/phpunit-coverage-tools

PHPUnit coverage tools

1783.0k33](/packages/robiningelbrecht-phpunit-coverage-tools)[juampi92/test-seo

Easy way to test your SEO

26341.0k](/packages/juampi92-test-seo)[playwright-php/playwright

Modern PHP library for Playwright automation: browsing, scraping, screenshots, testing, and more.

7613.0k5](/packages/playwright-php-playwright)[misantron/dbunit

DbUnit fork supporting PHPUnit 10/11/12

121.2M6](/packages/misantron-dbunit)

PHPackages © 2026

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