2017 © Pedro Peláez
 

symfony-bundle faker-bundle

image

davidbadura/faker-bundle

  • Tuesday, September 22, 2015
  • by DavidBadura
  • Repository
  • 2 Watchers
  • 12 Stars
  • 44,310 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 2 Forks
  • 1 Open issues
  • 6 Versions
  • 4 % Grown

The README.md

DavidBaduraFakerBundle

The project is no longer supported., (*1)

Build Status Bitdeli Badge, (*2)

This bundle provide the fzaninotto/Faker, a PHP library that generates fake data for you. You can use this bundle in combination with DavidBaduraFixturesBundle., (*3)

Usage

``` php $faker = $container->get('davidbadura_faker.faker'); // generate data by accessing properties echo $faker->name; // 'Lucy Cechtelar'; echo $faker->address; // "426 Jordy Lodge // Cartwrightshire, SC 88120-6700" echo $faker->text; // Sint velit eveniet. Rerum atque repellat voluptatem quia rerum. Numquam excepturi // beatae sint laudantium consequatur. Magni occaecati itaque sint et sit tempore. Nesciunt // amet quidem. Iusto deleniti cum autem ad quia aperiam. // A consectetur quos aliquam. In iste aliquid et aut similique suscipit. Consequatur qui // quaerat iste minus hic expedita. Consequuntur error magni et laboriosam. Aut aspernatur // voluptatem sit aliquam. Dolores voluptatum est. // Aut molestias et maxime. Fugit autem facilis quos vero. Eius quibusdam possimus est. // Ea quaerat et quisquam. Deleniti sunt quam. Adipisci consequatur id in occaecati. // Et sint et. Ut ducimus quod nemo ab voluptatum., (*4)


For more information, you can read the faker library [documentation](https://github.com/fzaninotto/Faker). Installation ------------ Add DavidBaduraFakerBundle in your composer.json ``` js { "require": { "davidbadura/faker-bundle": "1.0.*" } }

and modify your AppKernel, (*5)

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    $bundles[] = new DavidBadura\FakerBundle\DavidBaduraFakerBundle();
}

Bundle configuration

``` yaml, (*6)

app/config/config.yml

david_badura_faker: locale: de_DE #default: en_EN, (*7)


Add your own Provider --------------------- First, you must create your provider ``` php <?php namespace YourBundle\Faker\Provider; class Book extends \Faker\Provider\Base { public function title($nbWords = 5) { $sentence = $this->generator->sentence($nbWords); return substr($sentence, 0, strlen($sentence) - 1); } public function ISBN() { return $this->generator->randomNumber(13); } }

now you can register your provider as a service and add the davidbadura_faker.provider tag., (*8)

``` yaml your_bundle.faker.provider.test: class: YourBundle\Faker\Provider\Book arguments: - @davidbadura_faker.faker tags: - { name: davidbadura_faker.provider }, (*9)


finaly, you can use your new provider ``` php $faker = $container->get('davidbadura_faker.faker'); // generate data by accessing properties echo $faker->ISBN; // '1463738531452';

For more information about providers, you can read the faker library documentation., (*10)

The Versions

22/09 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

by David Badura

symfony2 fixtures faker

14/09 2015

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

 

by David Badura

symfony2 fixtures faker

31/05 2015

1.0.x-dev

1.0.9999999.9999999-dev

  Sources   Download

MIT

The Requires

 

by David Badura

symfony2 fixtures faker

16/01 2014

v1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

 

by David Badura

symfony2 fixtures faker

24/09 2013

v1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

by David Badura

symfony2 fixtures faker

12/11 2012

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

by David Badura

symfony2 faker