smknstd/fakerphp-picsum-images

Alternative image provider for fakerphp using picsum.photos

Fund package maintenance!
smknstd

v1.0.2 2022-10-11 08:45 UTC

This package is auto-updated.

Last update: 2024-03-30 00:37:43 UTC


README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Introduction

Alternative image provider for fakerphp using picsum.photos

This package has been forked from mmo/faker-images for fzaninotto/faker (deprecated ~ Oct 2020).

Ressources

Installation

You can install the package via composer in dev dependency section:

composer require --dev smknstd/fakerphp-picsum-images

Usage

$faker = \Faker\Factory::create();
$faker->addProvider(new \Smknstd\FakerPicsumImages\FakerPicsumImagesProvider($faker));

// return a string that contains a url like 'https://picsum.photos/800/600/'
$faker->imageUrl(width: 800, height: 600); 

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

Also, there are some more options :

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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