This package is abandoned and no longer maintained. No replacement package was suggested.

Faker Service Provider for Silex

1.0.2 2013-09-18 15:05 UTC

This package is auto-updated.

Last update: 2022-02-01 12:26:57 UTC


A Faker service provider for Silex.

N.B: this provider is locale aware. It will automatically configure Faker to use the most suited locale for the request.


This project is DEPRECATED and should NOT be used.

If someone magically appears and wants to maintain this project, I'll gladly give access to this repository.


Initialize it using register. Its default behavior is to use Faker's factory and try to guess the right locale to use.


use KPhoen\Provider\FakerServiceProvider;

$app->register(new FakerServiceProvider());

In this example, we use a custom factory and force the locale (both in the provider and in the whole application) to fr_FR:


use KPhoen\Provider\FakerServiceProvider;

$app->register(new FakerServiceProvider('\Acme\Faker\Factory', $guessLocale = false), array(
    'locale' => 'fr_FR',

From your controllers:


$app->get('/hello', function() use ($app) {
    return 'Hello ' . $app['faker']->name;

From Twig:

<!DOCTYPE html>
        <p>Hello {{ }}!</p>


Install the FakerServiceProvider adding kphoen/faker-service-provider to your composer.json or from CLI:

$ php composer.phar require 'kphoen/faker-service-provider:~1.0'


This provider is released under the MIT license.