tarnawski / fixtures
Tool to help manage fixtures in a PHP project
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/tarnawski/fixtures
Requires
- php: ^7.1
 - symfony/yaml: ^4.0
 
Requires (Dev)
- phpmd/phpmd: ^2.6
 - phpspec/phpspec: ^4.2
 - phpunit/phpunit: ^7.0
 - sebastian/phpcpd: ^4.0
 - squizlabs/php_codesniffer: ^3.2
 
This package is auto-updated.
Last update: 2025-10-15 02:40:22 UTC
README
Tool to help manage fixtures in a PHP project
Installation
$ composer require tarnawski/fixtures
Supported type of fixtures file
YAML
document: - id: 1 name: Secret document status: draft - id: 2 name: Other document status: published
JSON
{
  "document": [
      {
        "id": "1",
        "name": "Secret document",
        "status": "draft"
      },
      {
        "id": "2",
        "name": "Other document",
        "status": "published"
      }
    ]
}
XML
<?xml version="1.0" encoding="UTF-8"?> <fixtures> <document> <id>1</id> <name>Secret document</name> <status>draft</status> </document> <document> <id>2</id> <name>Other document</name> <status>published</status> </document> </fixtures>
Usage standalone
$loader = new FileLoader(); $parser = new JSONParser(); $driver = new PDODriver('database', 'host', 'port', 'user', 'passoword'); $fixtureBuilder = new FixtureBuilder($loader, $parser, $driver); $fixtureBuilder->load('fixtures/document.json');
Usage with Symfony
- Enable the Bundle:
 
$bundles = array( new Fixture\Bridge\Symfony\FixtureBundle(), );
- Configure the Bundle:
 
fixture: path: '%kernel.project_dir%/fixtures/document.json' loader: 'file' parser: 'json' driver: 'pdo'
- Run command:
 
php bin/console fixture:load