2017 © Pedro Peláez
 

library fixtures

Tool to help manage fixtures in a PHP project

image

tarnawski/fixtures

Tool to help manage fixtures in a PHP project

  • Wednesday, April 18, 2018
  • by tarnawski
  • Repository
  • 0 Watchers
  • 2 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Fixtures loader

Tool to help manage fixtures in a PHP project, (*1)

Build Status, (*2)

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

  1. Enable the Bundle:
$bundles = array(
    new Fixture\Bridge\Symfony\FixtureBundle(),
);

  1. Configure the Bundle:
fixture:
    path: '%kernel.project_dir%/fixtures/document.json'
    loader: 'file'
    parser: 'json'
    driver: 'pdo'
  1. Run command:
php bin/console fixture:load

The Versions

18/04 2018

dev-master

9999999-dev

Tool to help manage fixtures in a PHP project

  Sources   Download

MIT

The Requires

 

The Development Requires

by Tomasz Tarnawski