PHP code example of rootinc / faker-bonus

1. Go to this page and download the library: Download rootinc/faker-bonus 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/ */

    

rootinc / faker-bonus example snippets



$faker = Faker\Factory::create();
ProviderCollectionHelper::addAllProvidersTo($faker);
// Use Faker
$faker->hashtag;


$faker = Faker\Factory::create();
$faker->addProvider(new Provider\Hashtag($faker));
//...
// Add more Providers 
//...
// Use Faker
$faker->hashtag;



use Faker\Generator;

public function register() {
  //...
  // Whenever Faker\Generator is called, substitute the return value of this block
  $this->app->extend(Generator::class, function ($generator) {
      // Add Providers to the Faker\Generator class
      ProviderCollectionHelper::addAllProvidersTo($generator);
      // Return modified Faker\Generator
      return $generator;
  });
  //...
}

$faker->hashtag($

$faker->hashtag // '#this_is_fun'
$faker->hashtag(false) // 'this_is_fun'


$faker->mention($

$faker->mention // '@bartoletti.barbara'
$faker->mention(false) // 'bartoletti.barbara'


$faker->tweetText($nbParagraphs = 1, $

$faker->tweetText // '@BSCHADEN The a my were anchors for consider that one man perfectly. 😀 #EXPLOIT_CUTTINGEDGE_EYEBALLS'
$faker->tweetText(2) // '@BSCHADEN The a my were anchors for consider that one man perfectly.\n\n Created, rung and over flows let four it lane.😀 #EXPLOIT_CUTTINGEDGE_EYEBALLS'
$faker->tweetText(3, false) // '@BSCHADEN The a my were anchors for consider that one man perfectly.\n\n Created, rung and over flows let four it lane.\n\n Created, rung and over flows let four it lane. #EXPLOIT_CUTTINGEDGE_EYEBALLS'