mirror of
https://github.com/fzaninotto/Faker.git
synced 2025-03-21 15:59:52 +01:00
Updated readme
This commit is contained in:
parent
75e8ad03d5
commit
8c1a26909c
11
readme.md
11
readme.md
@ -8,11 +8,18 @@ Faker requires PHP >= 5.3.
|
||||
|
||||
## Basic Usage
|
||||
|
||||
Require the Faker autoloader to use Faker in a script
|
||||
```php
|
||||
<?php
|
||||
|
||||
require_once '/path/to/src/autoload.php';
|
||||
```
|
||||
Or use your own autoloader (ex: Symfony2 ClassLoader) to autoload the Faker namespace.
|
||||
|
||||
Use `Faker\Factory::create()` to create and initialize a faker generator, which can generate data by accessing properties named after the type of data you want.
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once '/path/to/src/Faker/Factory.php';
|
||||
$faker = Faker\Factory::create(); // $faker is a Faker\Generator instance
|
||||
|
||||
echo $faker->name;
|
||||
@ -223,7 +230,6 @@ You may want to get always the same generated data - for instance when using Fak
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once '/path/to/src/Faker/Factory.php';
|
||||
$faker = Faker\Factory::create();
|
||||
$faker->seed(1234);
|
||||
|
||||
@ -255,7 +261,6 @@ The following script generates a valid XML document:
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once '/path/to/src/Faker/Factory.php';
|
||||
$generator = Faker\Factory::create();
|
||||
?>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user