PHPackages                             davidepastore/lorempixel-twig-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. davidepastore/lorempixel-twig-extension

ActiveLibrary[Templating &amp; Views](/categories/templating)

davidepastore/lorempixel-twig-extension
=======================================

A Twig extension for the lorempixel service

v0.1.2(4y ago)322MITPHPPHP &gt;=5.3CI failing

Since Aug 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/DavidePastore/LoremPixel-Twig-Extension)[ Packagist](https://packagist.org/packages/davidepastore/lorempixel-twig-extension)[ RSS](/packages/davidepastore-lorempixel-twig-extension/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

[LoremPixel](http://lorempixel.com/) Twig Extension
===================================================

[](#lorempixel-twig-extension)

[![Latest version](https://camo.githubusercontent.com/b6b95624a716259eb2f4ffd02a98b775190e1a7b65c3c2dc184a41798d1c6945/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f446176696465506173746f72652f4c6f72656d506978656c2d547769672d457874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/davidepastore/LoremPixel-Twig-Extension)[![Build Status](https://github.com/DavidePastore/LoremPixel-Twig-Extension/workflows/Continuous%20Integration/badge.svg?branch=master)](https://github.com/DavidePastore/LoremPixel-Twig-Extension/actions?query=workflow%3A%22Continuous+Integration%22)[![Coverage Status](https://camo.githubusercontent.com/75a75e111b1c7c3efc50c2242e9fd294c9c8f4313a1069644575c7c2f8d79812/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f446176696465506173746f72652f4c6f72656d506978656c2d547769672d457874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/DavidePastore/LoremPixel-Twig-Extension/code-structure)[![Quality Score](https://camo.githubusercontent.com/577836578e1c1b8ec482f5a77b14e19425c9914b00b7f8a60c989cf900f4337c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f646176696465706173746f72652f4c6f72656d506978656c2d547769672d457874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/DavidePastore/LoremPixel-Twig-Extension)[![Total Downloads](https://camo.githubusercontent.com/78ce3c4673a0dac8509b6efca3e5e49d73113e384254b3faeb11f4c697b73eab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646176696465706173746f72652f4c6f72656d506978656c2d547769672d457874656e73696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/davidepastore/LoremPixel-Twig-Extension)[![PSR2 Conformance](https://camo.githubusercontent.com/75dca347689df3b8eb9733f223cebf0d8e502a2a36d3817e854c327918164a1f/68747470733a2f2f7374796c6563692e696f2f7265706f732f36353537313633312f736869656c64)](https://styleci.io/repos/65571631/)

This library integrates [LoremPixel](http://lorempixel.com/) service into [Twig](http://twig.sensiolabs.org/). You can use it to generate random image urls that you can use as placeholders in your application.

Installation
------------

[](#installation)

```
composer require "davidepastore/lorempixel-twig-extension"

```

Usage
-----

[](#usage)

Add `LoremPixelTwigExtension` to your Twig extensions:

```
$twig->addExtension(new LoremPixelTwigExtension());
```

In the templates, you then just call ``.

You can use different parameters for this function in this order:

NameTypeDescriptionDefaultExamplegraybooleanIs it a gray image?`false``lorempixel(true)`widthintThe width of the image.`400``lorempixel(true, 500)`heightintThe height of the image.`200``lorempixel(true, 500, 300)`categorystringThe category of the image. You can find all supported categories [here](http://lorempixel.com/).`null``lorempixel(true, 500, 300, 'cats')`numberintThe number of the image from the given category.`null``lorempixel(true, 500, 300, 'cats', 2)`textstringThe custom text to add to the image.`null``lorempixel(true, 500, 300, 'cats', 2, 'Dummy Text')`An example with all the parameters could be:

```

```

Testing
-------

[](#testing)

```
$ phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Davide Pastore](https://github.com/davidepastore)

License
-------

[](#license)

This library is released under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1026 days

Total

3

Last Release

1557d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1949364?v=4)[Davide Pastore](/maintainers/DavidePastore)[@DavidePastore](https://github.com/DavidePastore)

---

Top Contributors

[![DavidePastore](https://avatars.githubusercontent.com/u/1949364?v=4)](https://github.com/DavidePastore "DavidePastore (26 commits)")

---

Tags

lorempixelplaceholder-imagetwig-extensionrandomtwigimageimglorempixellorempixel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/davidepastore-lorempixel-twig-extension/health.svg)

```
[![Health](https://phpackages.com/badges/davidepastore-lorempixel-twig-extension/health.svg)](https://phpackages.com/packages/davidepastore-lorempixel-twig-extension)
```

###  Alternatives

[timber/timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

5.7k3.6M127](/packages/timber-timber)[twig/intl-extra

A Twig extension for Intl

36567.2M323](/packages/twig-intl-extra)[symfony/ux-twig-component

Twig components for Symfony

22017.2M313](/packages/symfony-ux-twig-component)[symfony/ux-live-component

Live components for Symfony

1636.5M116](/packages/symfony-ux-live-component)[twig/cssinliner-extra

A Twig extension to allow inlining CSS

22919.7M82](/packages/twig-cssinliner-extra)[twig/inky-extra

A Twig extension for the inky email templating engine

16613.6M71](/packages/twig-inky-extra)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
