PHP code example of incraigulous / data-factories

1. Go to this page and download the library: Download incraigulous/data-factories library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

incraigulous / data-factories example snippets



use Faker\Generator as Faker;

$factory->define('test-factory', function(Faker $faker) {

    $email = $faker->email;

    return [
        'name' => $faker->name,
        'email' => $email,
        'email_confirmation' => $email,
        'phone' => $faker->phoneNumber,
        'message' => $faker->paragraph(),
    ];
});

  protected function setUp() {
     parent::setUp();
     DataFactory::registerPath(__DIR__.'/factories/*.php');
   }