Use the PHP Faker library to generate more meaningful sample content.

Devel Generate is great for creating a lot of sample content in a hurry, but sometimes you want samples that are more meaningful, or closer to the content you expect users to generate. This is where Faker comes in.

This module has no hard dependency on Devel Generate, but to benefit from all the features you will have to enable both.

Faker is a PHP library that generates fake data for you

Faker (the library) can generate real looking names, addresses, emails, domains and more. Faker (the module) combines the library with quick content creation abilities provided by Devel Generate, to give you the power to easily generate real looking sample content.

GitHub mirror: https://github.com/baikho/drupal-faker

Relevant modules

  • Devel - See its submodule "Devel Generate"

Drupal 7

Installation w/ Drush make

The module includes a Drush make file that will automatically download the necessary library when installing via Drush make. Just add faker to your project's Drush make file.

Manual installation

Usage

  • Implement hook_faker_node_generate() from your module/feature. See faker.api.inc in the source for more info about the available hooks.
  • Run devel generate either from drush or the admin UI.

Examples

function hook_faker_node_generate($node, $faker) {
  if ($node->type === 'bio') {
    $node->title = $faker->name;
    $node->field_email[LANGUAGE_NONE][0]['value'] = $faker->email;
    $node->field_phone[LANGUAGE_NONE][0]['value'] = $faker->phoneNumber;
  }
}

Drupal 8

Installation

Just install as you would via composer and it will download the relevant Faker package.

Features

The 8.x version adds "Faker Profile" config entities, that are out of the box available for use with the Devel Generate "Generate" tasks.

content-overview-faker

Supporting organizations: 
Development and maintenance

Project information

Releases