kreyu / placeholder-image
Generate links for placeholder images using various providers
v1.0.1
2019-04-24 17:33 UTC
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-12-25 08:12:38 UTC
README
This package helps with usage of various placeholder image providers.
Zero dependencies, simple links.
Installation
You can install the package via composer:
composer require kreyu/placeholder-image
Testing
composer test
Usage
To generate the url placeholder image:
PlaceholderImage::with($providerAlias)->generate($width, $height, array $options, $ssl = true);
Example usage:
PlaceholderImage::with('dummy_image')->generate(600, 400, [ 'text' => 'Beep Boop', 'format' => 'png', 'background' => 'FF9900', 'foreground' => 'FFFFFF', ]);
Will give us the following url:
https://dummyimage.com/600x400/FF9900/FFFFFF.png&text=Beep+boop
Fourth argument allows to disable SSL support.
Supported providers
fill_murray
- fillmurray.comdummy_image
- dummyimage.complaceholder
- placeholder.complace_img
- placeimg.com
Using the invalid provider alias throws the InvalidProviderException
Fatal error: Uncaught Kreyu\PlaceholderImage\Exception\InvalidProviderException:
Requested provider invalid-prov does not exist.
License
The MIT License (MIT). Please see license file for more information.