PHP code example of paulhennell / faker-news

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

    

paulhennell / faker-news example snippets

 php
$faker = (new \Faker\Factory())::create();
$faker->addProvider(new \Faker\Provider\Fakenews($faker));
$faker->addProvider(new \Faker\Provider\Fakenewssource($faker));

// generate a headline
echo $faker->headline;

// generate a named newssource (75% Newspapers, 25% TV news as below)
echo $faker->NewssourceName;

// generate a Newspaper name
// 'The Daily Texas', 'The Morning Herald', 'Manchester Post' etc
echo $faker->NewspaperName;

// generate a TV source name
// 'KKN News', 'ATV', 'JKK 247' etc
echo $faker->TvNewsName;

 php

'headline' => $this->faker->headline(),
'publisher' => $this->faker->NewssourceName(),