Skip to content
This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
/ RandImgProvider Public archive

Faker PHP Provider. Generate random url images using rand-img.com

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

rand-img/RandImgProvider

RandImgProvider for Faker generator

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Faker provider for generating random images in your PHP projects. The default faker image provider, Lorem Pixel, is fine but it has too many requests and slow down your testing environment. This is the main reason why i made this PHP package.

Install

Via Composer

$ composer require randimg/faker-randimg-provider

Usage

use Faker\Factory;
use Faker\Generator;
use Siro\RandImg\RandImgProvider;

$faker = Factory::create();
$faker->addProvider(new RandImgProvider($faker));

$faker->imageUrl(); // http://www.rand-img.com/720/480
$faker->imageUrl(300, 200); // http://www.rand-img.com/300/200
$faker->imageUrl(720, 480, 'sky');  // http://www.rand-img.com/720/480/sky
$faker->imageUrl(720, 480, 'food', ['rand' => true]);   // http://www.rand-img.com/720/480/food?rand=4234532
$faker->imageUrl(720, 480, 'food', ['rand' => true, 'blur' => 4, 'gray' => 1]); // http://www.rand-img.com/720/480/food?rand=4234532&blur=4&gray=1

$faker->image(__DIR__, 200, 200);   // image path and filename joined
$faker->image(__DIR__, 200, 200);   // image path and filename joined
$faker->gif();  // gif path and filename

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email siro_diaz@yahoo.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.