Extensions

Images

Images extension for Xefi Faker PHP

Requirement

This extension is not included with the base faker php package, you'll need to require it:

composer require --dev xefi/faker-php-images

Image

Returns a Image object from the intervention/image package (documentation).

Example : 1280 x 720 example

$faker->image(width: 1280, height: 720, backgroundColor: '#cccccc', textColor: '#333333', text: 'My Placeholder text');

// Examples for saving the image
$image = $faker->image();
$image->toPng()->save('images/foo.png');

Image URL

$faker->imageUrl(width: 1280, height: 720); // https://placehold.co/1280x720

Copyright © 2024