PHPackages                             bernhard-webstudio/placeholder-bundle - 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. [Image &amp; Media](/categories/media)
4. /
5. bernhard-webstudio/placeholder-bundle

ActiveSymfony-bundle[Image &amp; Media](/categories/media)

bernhard-webstudio/placeholder-bundle
=====================================

Symfony bundle to generate placeholders for images

v2.0.0(3y ago)41311[3 issues](https://github.com/BernhardWebstudio/PlaceholderBundle/issues)MITPHPPHP &gt;=8.0

Since May 24Pushed 4d ago1 watchersCompare

[ Source](https://github.com/BernhardWebstudio/PlaceholderBundle)[ Packagist](https://packagist.org/packages/bernhard-webstudio/placeholder-bundle)[ Docs](https://github.com/BernhardWebstudio/PlaceholderBundle)[ GitHub Sponsors](https://github.com/GenieTim)[ Fund](https://tidelift.com/funding/github/packagist/bernhard-webstudio/placeholder-bundle)[ RSS](/packages/bernhard-webstudio-placeholder-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (23)Versions (16)Used By (0)

PlaceholderBundle
=================

[](#placeholderbundle)

[![GitHub Tests](https://github.com/BernhardWebstudio/PlaceholderBundle/workflows/PHP%20Tests/badge.svg)](https://github.com/BernhardWebstudio/PlaceholderBundle/workflows/PHP%20Tests/badge.svg)[![Travis](https://camo.githubusercontent.com/7aac34e736729de2a93b7ad6562121b2cb2d5dd5f1dd449749b21a8289874255/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4265726e6861726457656273747564696f2f506c616365686f6c64657242756e646c652e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/BernhardWebstudio/PlaceholderBundle)[![Coverage Status](https://camo.githubusercontent.com/bc6ddef19a556cc6b4c9dfbfb955c9861d9568b3e643d07b44ae5fe4ddb449d3/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f4265726e6861726457656273747564696f2f506c616365686f6c64657242756e646c652e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/BernhardWebstudio/PlaceholderBundle?branch=master)[![license](https://camo.githubusercontent.com/7123c32787e013be5a8a13598ad01f562754637ed6141e89b02e85bf16d3e63e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)[![FOSSA Status](https://camo.githubusercontent.com/95251e653720c4dcf1f2f84da51fe7c72dd46db0d9b5aff909296ce0532e3266/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532464265726e6861726457656273747564696f253246506c616365686f6c64657242756e646c652e7376673f747970653d736869656c64)](https://app.fossa.io/projects/git%2Bgithub.com%2FBernhardWebstudio%2FPlaceholderBundle?ref=badge_shield)

- [PlaceholderBundle](#placeholderbundle)
- [What is this bundle?](#what-is-this-bundle)
- [Installation](#installation)
    - [Applications that use Symfony Flex](#applications-that-use-symfony-flex)
    - [Applications that don't use Symfony Flex](#applications-that-dont-use-symfony-flex)
        - [Step 1: Download the Bundle](#step-1-download-the-bundle)
        - [Step 2: Enable the Bundle](#step-2-enable-the-bundle)
- [Configuration](#configuration)
- [Usage](#usage)
    - [In a Controller or Service](#in-a-controller-or-service)
    - [In Twig](#in-twig)
    - [Just the URL, please](#just-the-url-please)
    - [Pregenerate images](#pregenerate-images)
- [Contributions](#contributions)
    - [License](#license)
- [bernhard-webstudio/placeholder-bundle for enterprise](#bernhard-webstudioplaceholder-bundle-for-enterprise)

What is this bundle?
====================

[](#what-is-this-bundle)

Use this bundle if you are looking for an easy way to generate beautiful placeholders or thumbnails for your project.

Do you provide a site with pages full of images? Do you use a lazy-loader with a grey-only image? Then this bundle is something for you respectively your site!

Depending on your configuration and your local environment, you can let the bundle return placeholders generated with [Primitive](https://github.com/fogleman/primitive) or [sqip](https://github.com/technopagan/sqip/blob/master/README.md).

Installation
============

[](#installation)

You need to have the service installed which you want to use. Refer to their webpages linked above to get the installation guide. To install this bundle, refer to the following guide.

Applications that use Symfony Flex
----------------------------------

[](#applications-that-use-symfony-flex)

*(This installation type is not yet supported. Please refer to the next installations instructions or create a recipe.)*Open a command console, enter your project directory and execute:

```
$ composer require bernhard-webstudio/placeholder-bundle
```

Applications that don't use Symfony Flex
----------------------------------------

[](#applications-that-dont-use-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require bernhard-webstudio/placeholder-bundle
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `app/AppKernel.php` file of your project:

```
