PHPackages                             yucca/prerender-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. yucca/prerender-bundle

ActiveSymfony-bundle

yucca/prerender-bundle
======================

Allows you to easily use prerender for your Symfony apps running Client-Side MVC

3.2(7y ago)5617.0k↓100%15[8 issues](https://github.com/rjanot/YuccaPrerenderBundle/issues)MITPHPPHP &gt;=7

Since Oct 13Pushed 7y ago6 watchersCompare

[ Source](https://github.com/rjanot/YuccaPrerenderBundle)[ Packagist](https://packagist.org/packages/yucca/prerender-bundle)[ Docs](http://rjanot.github.io/)[ RSS](/packages/yucca-prerender-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (9)Used By (0)

Yucca/PrerenderBundle
=====================

[](#yuccaprerenderbundle)

[![Build Status](https://camo.githubusercontent.com/d632b1de64fcce42431b14f96230def746738dedd96475915da5a6cdf4b6b196/68747470733a2f2f7472617669732d63692e6f72672f726a616e6f742f597563636150726572656e64657242756e646c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/rjanot/YuccaPrerenderBundle)[![Coverage Status](https://camo.githubusercontent.com/bfbd0d702e69076a6d8ce0dbec46ee802012a97159a1c295becb3e5009034db0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f726a616e6f742f597563636150726572656e64657242756e646c652f62616467652e706e67)](https://coveralls.io/r/rjanot/YuccaPrerenderBundle)

Backbone, EmberJS, Angular and so more are your daily basis ? In case of an admin area, that's fine, but on your front office, you might encounter some SEO problems

Thanks to [Prerender.io](http://www.prerender.io), you now can dynamically render your JavaScript pages in your server using PhantomJS.

This bundle is largely inspired by bakura10 work on [zfr-prerender](https://github.com/zf-fr/zfr-prerender)

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

[](#installation)

Install the module by typing (or add it to your `composer.json` file):

```
$ php composer.phar require "yucca/prerender-bundle" "0.1.*@dev"
```

Register the bundle in `app/AppKernel.php`:

```
// app/AppKernel.php
public function registerBundles()
{
    return array(
        // ...
        new Yucca\PrerenderBundle\YuccaPrerenderBundle(),
    );
}

```

Enable the bundle's configuration in `app/config/config.yml`:

```
# app/config/config.yml
yucca_prerender: ~

```

Documentation
-------------

[](#documentation)

### How it works

[](#how-it-works)

1. Check to make sure we should show a prerendered page
    1. Check if the request is from a crawler (agent string)
    2. Check to make sure we aren't requesting a resource (js, css, etc...)
    3. (optional) Check to make sure the url is in the whitelist
    4. (optional) Check to make sure the url isn't in the blacklist
2. Make a `GET` request to the [prerender service](https://github.com/collectiveip/prerender) (PhantomJS server) for the page's prerendered HTML
3. Return that HTML to the crawler

### Customization

[](#customization)

This bundle comes with a sane default, extracted from [prerender-node middleware](https://github.com/collectiveip/prerender-node), but you can easily customize it:

```
#app/config/config.yml
yucca_prerender:
    ....

```

#### Prerender URL

[](#prerender-url)

By default, YuccaPrerenderBundle uses the Prerender.io service deployed at `http://prerender.herokuapp.com`. However, you may want to [deploy it on your own server](https://github.com/collectiveip/prerender#deploying-your-own). To that extent, you can customize YuccaPrerenderBundle to use your server using the following configuration:

```
#app/config/config.yml
yucca_prerender:
    backend_url: http://localhost:3000

```

With this config, here is how YuccaPrerender will proxy the "" request:

`GET`

#### Crawler user-agents

[](#crawler-user-agents)

YuccaPrerender decides to pre-render based on the User-Agent string to check if a request comes from a bot or not. By default, those user agents are registered: 'baiduspider', 'facebookexternalhit', 'twitterbot'. Googlebot, Yahoo, and Bingbot should not be in this list because we support *escaped\_fragment* instead of checking user agent for those crawlers. Your site must have to understand the '#!' ajax url notation.

You can add other User-Agent string to evaluate using this sample configuration:

```
#app/config/config.yml
yucca_prerender:
    crawler_user_agents: ['yandex', 'msnbot']

```

#### Ignored extensions

[](#ignored-extensions)

YuccaPrerender is configured by default to ignore all the requests for resources with those extensions: `.js`, `.css`, `.less`, `.png`, `.jpg`, `.jpeg`, `.gif`, `.pdf`, `.doc`, `.txt`, `.zip`, `.mp3`, `.rar`, `.exe`, `.wmv`, `.doc`, `.avi`, `.ppt`, `.mpg`, `.mpeg`, `.tif`, `.wav`, `.mov`, `.psd`, `.ai`, `.xls`, `.mp4`, `.m4a`, `.swf`, `.dat`, `.dmg`, `.iso`, `.flv`, `.m4v`, `.torrent`. Those are never pre-rendered.

You can add your own extensions using this sample configuration:

```
#app/config/config.yml
yucca_prerender:
    ignored_extensions: ['.less', '.pdf']

```

#### Whitelist

[](#whitelist)

Whitelist a single url path or multiple url paths. Compares using regex, so be specific when possible. If a whitelist is supplied, only url's containing a whitelist path will be prerendered.

Here is a sample configuration that *only* pre-render URLs that contains "/users/":

```
#app/config/config.yml
yucca_prerender:
    whitelist_urls: ['/users/*']

```

> Note: remember to specify URL here and not Symfony2 route names.

#### Blacklist

[](#blacklist)

Blacklist a single url path or multiple url paths. Compares using regex, so be specific when possible. If a blacklist is supplied, all url's will be pre-rendered except ones containing a blacklist part. Please note that if the referer is part of the blacklist, it won't be pre-rendered too.

Here is a sample configuration that prerender all URLs *excepting* the ones that contains "/users/":

```
#app/config/config.yml
yucca_prerender:
    blacklist_urls: ['/users/*']

```

> Note: remember to specify URL here and not Symfony22 route names.

### Testing

[](#testing)

If you want to make sure your pages are rendering correctly:

1. Open the Developer Tools in Chrome (Cmd + Atl + J)
2. Click the Settings gear in the bottom right corner.
3. Click "Overrides" on the left side of the settings panel.
4. Check the "User Agent" checkbox.
5. Choose "Other..." from the User Agent dropdown.
6. Type googlebot into the input box.
7. Refresh the page (make sure to keep the developer tools open).

Thanks
======

[](#thanks)

- Thanks to [bakura10](https://github.com/zf-fr/zfr-prerender) for the Zend Framework version.
- Thanks to [Romain Boyer](https://twitter.com/RomainBOYER) to make me discover prerender.io
- Thanks to the prerender team and all JS MVC developpers

###  Health Score

38

—

LowBetter than 84% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 78.9% 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 ~272 days

Recently: every ~323 days

Total

8

Last Release

2681d ago

Major Versions

1.4 → 3.02018-01-12

PHP version history (2 changes)1.0PHP &gt;=5.3.2

3.0PHP &gt;=7

### Community

Maintainers

![](https://www.gravatar.com/avatar/df5d5cb857bee815e404964c06d693da0ec39e6658d915578eb11aa0c6200838?d=identicon)[rjanot](/maintainers/rjanot)

---

Top Contributors

[![rjanot](https://avatars.githubusercontent.com/u/630380?v=4)](https://github.com/rjanot "rjanot (30 commits)")[![tomfun](https://avatars.githubusercontent.com/u/5002775?v=4)](https://github.com/tomfun "tomfun (8 commits)")

---

Tags

prerenderMVC js

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yucca-prerender-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/yucca-prerender-bundle/health.svg)](https://phpackages.com/packages/yucca-prerender-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M232](/packages/nelmio-api-doc-bundle)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M192](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[hautelook/alice-bundle

Symfony bundle to manage fixtures with Alice and Faker.

19519.4M34](/packages/hautelook-alice-bundle)

PHPackages © 2026

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