atreo/faker

Implementation of fzaninotto/faker to Nette Framework.

v1.0.2 2016-04-26 11:17 UTC

This package is auto-updated.

Last update: 2024-10-27 09:52:55 UTC


README

Installation

$ composer require atreo/faker

add extension configuration before kdyby/console:

faker: Atreo\Faker\DI\FakerExtension

faker:
	count: 10 # default count
	entities:
		My\Entity\Name:
			count: 50
			formatters:
				type: Nette\DI\Statement('randomElement', [['free', 'paid']])
				slug: Nette\DI\Statement('slug', [5, false])

		Another\Entity\Name:
			formatters:
				name: Nette\DI\Statement('sentence', [6])
				slug: Nette\DI\Statement('slug', [4])
				isPublic: true

Now you can run:

$ php www/index.php faker:list
$ php www/index.php faker:fake My\Entity\Name 15

List of formatters you can find here.

Also you can use oneByOne:

type: Nette\DI\Statement('oneByOne', [[1, 2, 3, 4]])