davidepastore / lorempixel-twig-extension
A Twig extension for the lorempixel service
v0.1.2
2022-03-26 18:59 UTC
Requires
- php: >=5.3
- twig/twig: ~1.10
Requires (Dev)
- phpunit/phpunit: ~4.0
- scrutinizer/ocular: ~1.1
This package is auto-updated.
Last update: 2024-10-27 00:30:22 UTC
README
This library integrates LoremPixel service into Twig. You can use it to generate random image urls that you can use as placeholders in your application.
Installation
composer require "davidepastore/lorempixel-twig-extension"
Usage
Add LoremPixelTwigExtension
to your Twig extensions:
$twig->addExtension(new LoremPixelTwigExtension());
In the templates, you then just call <img src="{{ lorempixel() }}">
.
You can use different parameters for this function in this order:
An example with all the parameters could be:
<img src="{{ lorempixel(true, 500, 300, 'cats', 2, 'Dummy Text') }}">
Testing
$ phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
This library is released under the MIT license.