Skip to content

Commit 838ac6d

Browse files
committed
updating the content
1 parent 1f324e0 commit 838ac6d

File tree

1 file changed

+53
-18
lines changed

1 file changed

+53
-18
lines changed

README.md

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,72 @@
1+
![license](https://img.shields.io/github/license/pattern-lab/plugin-php-faker.svg?maxAge=2592000)]
2+
[![Packagist](https://img.shields.io/packagist/v/pattern-lab/plugin-faker.svg?maxAge=2592000)](https://packagist.org/packages/pattern-lab/plugin-faker) [![Gitter](https://img.shields.io/gitter/room/pattern-lab/php.svg?maxAge=2592000)](https://gitter.im/pattern-lab/php)
3+
14
# Faker Plugin for Pattern Lab
25

3-
The Faker Plugin adds support for the [Faker Library](https://github.com/fzaninotto/Faker) to Pattern Lab.
6+
The Faker Plugin adds [Faker](https://github.com/fzaninotto/Faker) support to Pattern Lab. The Faker Plugin will create unique content each time Pattern Lab is generated. You can also use the Faker Plugin to provide locale appropriate content.
47

58
## Installation
69

7-
Pattern Lab PHP uses [Composer](https://getcomposer.org/) to manage project dependencies with Pattern Lab Editions. To add the Faker Plugin to the dependencies list for your Edition you can type the following in the command line at the base of your project:
10+
To add the Faker Plugin to your project using [Composer](https://getcomposer.org/) type:
811

912
composer require pattern-lab/plugin-faker
1013

1114
See Packagist for [information on the latest release](https://packagist.org/packages/pattern-lab/plugin-faker).
1215

1316
## Usage
1417

15-
To use this in your project set the value for a data option to:
18+
You can create fake data in your `json` or `yml` data files by using this format:
19+
20+
"key": "Faker.[formatter]([options])"
21+
22+
If a formatter has no options or you want to use the formatter's default options you can use the following format:
23+
24+
"key": "Faker.[formatter]"
25+
26+
See below for a list of formatters and their options.
27+
28+
## Example
29+
30+
To create a random first name without regard to gender you can add the following to your `json` or `yml` data files:
31+
32+
"firstName": "Faker.firstName"
33+
34+
To specify a gender you would use:
35+
36+
"firstName": "Faker.firstName('female')"
37+
38+
## Formatters
39+
40+
The Faker Plugin supports the following content formatters:
41+
42+
* Faker\Provider\en_US\Person
43+
* Faker\Provider\en_US\Address
44+
* Faker\Provider\en_US\PhoneNumber
45+
* Faker\Provider\en_US\Company
46+
* Faker\Provider\Lorem
47+
* Faker\Provider\Internet
48+
* Faker\Provider\Color
49+
* Faker\Provider\Payment
50+
* Faker\Provider\DateTime
51+
* Faker\Provider\Image
52+
* Faker\Provider\Miscellaneous
53+
54+
See the official repository for a [list of options available to each formatter](https://github.com/fzaninotto/Faker#formatters).
55+
56+
## Locales
57+
58+
The content produced by Faker can be localized based on a Faker locale. If the Faker locale isn't supported by a formatter the content will fall back to the default `en_US`. There is a [list of Faker locales](https://github.com/fzaninotto/Faker/tree/master/src/Faker/Provider).
1659

17-
```
18-
"key": "Faker.[formatter]([options])",
19-
```
60+
To update your Faker locale you can either directly edit `./config/config.yml` or use the command line option:
2061

21-
For example, to have a random first name use:
62+
php core/console --config --set faker.locale=[locale]
2263

23-
```
24-
"firstName": "Faker.firstName('female')",
25-
```
64+
For example:
2665

27-
Using Mustache as an example you'd use:
66+
php core/console --config --set faker.locale=fr_FR
2867

29-
```
30-
First Name: {{ firstName }}
31-
```
68+
## Disabling the Plugin
3269

33-
would output:
70+
To disable the Faker plugin you can either directly edit `./config/config.yml` or use the command line option:
3471

35-
```
36-
First Name: Mary
37-
```
72+
php core/console --config --set faker.on=false

0 commit comments

Comments
 (0)