emanueleminotto / faker-service-provider
Faker Service Provider for Silex
Installs: 2 500
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- fzaninotto/faker: ~1.4
- silex/silex: ~1
Requires (Dev)
- emanueleminotto/faker-placehold-it-provider: ~1.0
- fzaninotto/company-name-generator: dev-master
- phpunit/phpunit: ~4.4
Suggests
- emanueleminotto/faker-placehold-it-provider: placehold.it provider
- fzaninotto/company-name-generator: generate names for english tech companies with class
This package is auto-updated.
Last update: 2024-10-28 07:22:51 UTC
README
A Faker service provider for Silex.
API: emanueleminotto.github.io/FakerServiceProvider
Install
Install Silex using Composer.
Install the FakerServiceProvider adding emanueleminotto/faker-service-provider
to your composer.json or from CLI:
$ composer require emanueleminotto/faker-service-provider
Usage
Initialize it using register
use EmanueleMinotto\FakerServiceProvider\FakerServiceProvider; $app->register(new FakerServiceProvider(), array( 'faker.providers' => array( 'CompanyNameGenerator\\FakerProvider', 'EmanueleMinotto\\Faker\\PlaceholdItProvider', ), // default empty 'locale' => 'it_IT', // default: en_US ));
From PHP
$app->get('/hello', function () use ($app) { return 'Hello ' . $app['faker']->name; });
From Twig
<!DOCTYPE html> <html> <body> <p>Hello {{ app.faker.name }}!</p> </body> </html>