{"id":26178697,"url":"https://github.com/linkorb/transmogrifier","last_synced_at":"2025-04-14T22:27:03.138Z","repository":{"id":9920996,"uuid":"11932060","full_name":"linkorb/transmogrifier","owner":"linkorb","description":"Database fixture library, commmand-line tools and Behat vocab. If you are a tester, you need this :-)","archived":false,"fork":false,"pushed_at":"2015-03-02T08:27:59.000Z","size":165,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-28T10:47:32.813Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linkorb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-06T19:02:44.000Z","updated_at":"2017-08-04T07:26:11.000Z","dependencies_parsed_at":"2022-09-14T05:01:27.551Z","dependency_job_id":null,"html_url":"https://github.com/linkorb/transmogrifier","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkorb%2Ftransmogrifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkorb%2Ftransmogrifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkorb%2Ftransmogrifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linkorb%2Ftransmogrifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linkorb","download_url":"https://codeload.github.com/linkorb/transmogrifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248970732,"owners_count":21191479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-11T21:42:09.301Z","updated_at":"2025-04-14T22:27:03.120Z","avatar_url":"https://github.com/linkorb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transmogrifier\n\u003cimg src=\"http://www.linkorb.com/d/online/linkorb/upload/transmogrifier.gif\" align=\"right\" /\u003e\n\nTransmogrifier is a tool to help setup your database fixtures before running your tests.\n\nYou can use it in the following ways:\n\n1. As a simple command-line utility (great for your build scripts and continuous integration)\n2. As a PHP library\n3. As a Behat extension, enabling Gherkin statements for automated BDD database testing\n\n## 1. Command-line utility\n\nYou can use Transmogrifier as a command-line utility (stand-alone, or as part of your PHP project through composer).\n\n### Standalone\n\n0. clone this git repository\n0. run `composer install` to install all dependencies\n0. run `bin/transmogrifier --help` for a list of available commands\n\n### Through composer, in your PHP project:\n\nOpen your `composer.json` file, and add this to the `require` section:\n\n```json\n\"linkorb/transmogrifier\": \"dev-master\"\n```\n\nYou can now run `vendor/bin/transmogrifier`.\n\n### Adding transmogrifier commands to an existing Symfony/Console application\n\nAdd the following line to an existing Symfony/Console application in order to enable the Transmogrifier commands to it:\n\n```php\n$application-\u003eadd(new \\LinkORB\\Transmogrifier\\Command\\DatasetApplyCommand());\n```\n\n### Available commands\n\n#### transmogrifier:datasetapply\n\nThe most interesting usage through the command-line is the `transmogrifier:applydataset` command.\n\nYou can use it like this:\n\n```\nbin/transmogrifier transmogrifier:applydataset --dbname=test example/user.yml\n```\n\nThis command will ensure that the `dbname` database contains the dataset specified in `example/user.yml`\n\n## 2. PHP Library\n\nYou can use the Transmogrifier very easily from within your own PHP projects as a library.\n\n### Installing the library through composer\n\npen your `composer.json` file, and add this to the `require` section:\n\n```json\n\"linkorb/transmogrifier\": \"dev-master\"\n```\n\n### How to use the library\n\nThe 2 main classes are:\n\n* `Dataset`: A class that can load datasets from files, and apply them to databases.\n* `Database`: A connection to a database, providing helpers for initializing the connection. \n\nHere's an example usage:\n\n```php\n$db = new Database();\n// Optionally initialize db parameters by file, cli options, or explicit values\n$db-\u003eparseConf('/path/to/my/dbconf/test.conf');\n$db-\u003econnect();\n\n$dataset = new Dataset();\n$dataset-\u003eloadDatasetFile('/path/to/my/dataset.yml');\n$dataset-\u003eapplyTo($db);\n```\n\n## 3. Behat Extension\n\nThere is a Transmogrifier Extension available for Behat!\n\nThis allows you to use Transmogrifier directly from your Behat .feature files.\n\nCheck out the extension and it's documentation here:\n\n* [https://github.com/linkorb/transmogrifierextension](https://github.com/linkorb/transmogrifierextension)\n\n## Supported file-formats\n\nThe dataset importer is based on phpunit/dbunit. It currently supports the following file-formats:\n\n- YAML\n- Flat XML\n- XML\n- CSV\n\nThe Dataset loader guesses the format based on the file-extension.\n\nPlease refer to the `example/` directory for datasets in these formats.\nThe PHPUnit documentation contains further information about the loaders: \n\n* [PHPUnit DBUnit documentation](http://phpunit.de/manual/current/en/database.html)\n\n## Database .conf files\n\nTo simplify connecting to your database, Transmogrify can load conneciton settings from a simple `.conf` file.\n\nAn example file looks like this:\n\n```ini\nname=test\nserver=127.0.0.1\nusername=susie\npassword=mrbun\ndriver=mysql\n```\n\nYou can use these `.conf` files in all Transmogrifier modes: Command-line, Behat, or library.\nThe connection is established through `PDO`, so all PDO supported databases will work.\n\n## Example datasets\n\nThe `examples/` directory contains a few datasets you can use to try out Transmogrifier,\nsee how it works, and copy as a starting-point for your own datasets.\n\n### Create the schema\n\nThe examples will ensure 2 users, 'Calvin' and 'Hobbes', are registed in your `user` table.\n\nBefore you can try these out, use the following SQL to generate the `user` table in your `test` database:\n\n```sql\nCREATE TABLE user (id int, name varchar(16), email varchar(32), password varchar(32));\n```\n\n## Brought to you by the LinkORB Engineering team\n\n\u003cimg src=\"http://www.linkorb.com/d/meta/tier1/images/linkorbengineering-logo.png\" width=\"200px\" /\u003e\u003cbr /\u003e\nCheck out our other projects at [linkorb.com/engineering](http://www.linkorb.com/engineering).\n\nBtw, we're hiring!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkorb%2Ftransmogrifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinkorb%2Ftransmogrifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinkorb%2Ftransmogrifier/lists"}