PHP code example of toneflix-code / fakerphp-lorem-toneflix

1. Go to this page and download the library: Download toneflix-code/fakerphp-lorem-toneflix 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/ */

    

toneflix-code / fakerphp-lorem-toneflix example snippets


$faker = \Faker\Factory::create();
$faker->addProvider(new \ToneflixCode\FakerLoremToneflix\FakerLoremToneflixProvider($faker));

// return a string that contains a url like 'https://lorem.toneflix.com.ng/images/avatar?w=800&h=600'
$faker->imageUrl(width: 800, height: 600, category: 'avatar');

// download a properly sized image from lorem toneflix into a file with a file path like '/tmp/13b73edae8443990be1aa8f1a483bc27.jpg'
$filePath= $faker->image(dir: '/tmp', width: 640, height: 480);