randimg/faker-randimg-provider

This package is abandoned and no longer maintained. No replacement package was suggested.

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

1.0.0 2018-07-22 12:19 UTC

This package is not auto-updated.

Last update: 2021-02-06 09:39:49 UTC


README

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.