alirezasedghi / laravel-image-faker
A library to generate fake images for Laravel
Installs: 5 832
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 1
Open Issues: 2
Type:laravel
Requires
- php: >=8.0.0
README
Description
Laravel Image Faker is an alternative image provider for FakerPHP.
Installation
composer require alirezasedghi/laravel-image-faker
Resources
The following sources are utilized by this project to create random images:
- Lorem Picsum
- LoremFlickr
- PlaceDog
- Kittens (Random Cats) by TheOldReader.com
- Fake People by BoredHumans.com
Methods
Usage
/** * Define the model's default state. * * @return array<string, mixed> */ public function definition(): array { /** * In order to utilize other services, the following substitutes can be used: * - new ImageFaker(new LoremFlickr()); * - new ImageFaker(new PlaceDog()); * - new ImageFaker(new Kittens()); * - new ImageFaker(new FakePeople()); */ $imageFaker = new ImageFaker(new Picsum()); return [ 'title' => $this->faker->sentence(), 'content' => $this->faker->paragraph(), 'attachments' => $imageFaker->image( storage_path("app/attachments/") ) ]; }
Contributing
Don't hesitate to send a PR if you're looking for a service that's not available in this package. 😁
License
The MIT License (MIT). Please see License File for more information.