PHPackages                             keliix06/laravel-prerender - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. keliix06/laravel-prerender

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

keliix06/laravel-prerender
==========================

Laravel middleware for prerendering javascript-rendered pages on the fly for SEO

v2.0.2(8y ago)14.7k4[1 PRs](https://github.com/keliix06/Laravel-Prerender/pulls)MITPHPPHP &gt;=5.5.9

Since Sep 30Pushed 3y agoCompare

[ Source](https://github.com/keliix06/Laravel-Prerender)[ Packagist](https://packagist.org/packages/keliix06/laravel-prerender)[ RSS](/packages/keliix06-laravel-prerender/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (6)Used By (0)

#### For Laravel 4, use the [1.0 branch](https://github.com/JeroenNoten/Laravel-Prerender/tree/1.0)

[](#for-laravel-4-use-the-10-branch)

Laravel Prerender [![Build Status](https://camo.githubusercontent.com/790651aa78dab4e5beb5c2a7449f61baa640097d75b8f1837dc8f7406d3986b3/68747470733a2f2f7472617669732d63692e6f72672f4a65726f656e4e6f74656e2f4c61726176656c2d50726572656e6465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/JeroenNoten/Laravel-Prerender)
========================================================================================================================================================================================================================================================================================================================================

[](#laravel-prerender-)

Google, Facebook, Twitter, Yahoo, and Bing are constantly trying to view your website... but they don't execute javascript. That's why Prerender was built. Prerender is perfect for AngularJS SEO, BackboneJS SEO, EmberJS SEO, and any other javascript framework.

This middleware intercepts requests to your Laravel website or application from crawlers, and then makes a call to the (external) Prerender Service to get the static HTML instead of the javascript for that page.

Prerender adheres to google's `_escaped_fragment_` proposal, which we recommend you use. It's easy:

- Just add `` to the `` of all of your pages
- If you use hash urls (#), change them to the hash-bang (#!), but you can also use HTML5's push-state
- That's it! Perfect SEO on javascript pages.

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

[](#installation)

Require this package run: `composer require nutsweb/laravel-prerender`

After installing, add the ServiceProvider to the providers array in `config/app.php`.

```
'Nutsweb\LaravelPrerender\LaravelPrerenderServiceProvider',

```

If you want to make use of the prerender.io service, add the following to your `.env` file:

```
PRERENDER_TOKEN=yoursecrettoken

```

If you are using a self-hosted service, add the server address in the `.env` file.

```
PRERENDER_URL=http://example.com

```

You can disable the service by adding the following to your `.env` file:

```
PRERENDER_ENABLE=false

```

This may be useful for your local development environment.

How it works
------------

[](#how-it-works)

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

Customization
=============

[](#customization)

To customize the whitelist and the blacklist, you first have to publish the configuration file:

```
$ php artisan vendor:publish

```

### Whitelist

[](#whitelist)

Whitelist paths or patterns. You can use asterix syntax. If a whitelist is supplied, only url's containing a whitelist path will be prerendered. An empty array means that all URIs will pass this filter. Note that this is the full request URI, so including starting slash and query parameter string.

```
// prerender.php:
'whitelist' => [
    '/frontend/*' // only prerender pages starting with '/frontend/'
],
```

### Blacklist

[](#blacklist)

Blacklist paths to exclude. You can use asterix syntax. If a blacklist is supplied, all url's will be prerendered except ones containing a blacklist path. By default, a set of asset extentions are included (this is actually only necessary when you dynamically provide assets via routes). Note that this is the full request URI, so including starting slash and query parameter string.

```
// prerender.php:
'blacklist' => [
    '/api/*' // do not prerender pages starting with '/api/'
],
```

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

[](#contributing)

I love any contributions! Feel free to create issues or pull requests.

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2014 Jeroen Noten

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 81.4% 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 ~322 days

Total

5

Last Release

2952d ago

Major Versions

1.0.x-dev → v2.0.02015-09-02

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v2.0.0PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/49ddbb6417a772d0c13e2371d109ce952fcc5b69f8de2c0f1eba6b4f6dbc677b?d=identicon)[nakiner](/maintainers/nakiner)

---

Top Contributors

[![jeroennoten](https://avatars.githubusercontent.com/u/4370753?v=4)](https://github.com/jeroennoten "jeroennoten (35 commits)")[![ElGatoLoco](https://avatars.githubusercontent.com/u/7573121?v=4)](https://github.com/ElGatoLoco "ElGatoLoco (5 commits)")[![MichielDeMey](https://avatars.githubusercontent.com/u/793406?v=4)](https://github.com/MichielDeMey "MichielDeMey (1 commits)")[![thoop](https://avatars.githubusercontent.com/u/1259374?v=4)](https://github.com/thoop "thoop (1 commits)")[![weotch](https://avatars.githubusercontent.com/u/77567?v=4)](https://github.com/weotch "weotch (1 commits)")

---

Tags

laravelprerender

### Embed Badge

![Health badge](/badges/keliix06-laravel-prerender/health.svg)

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

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[nutsweb/laravel-prerender

Laravel middleware for prerendering javascript-rendered pages on the fly for SEO

279165.5k1](/packages/nutsweb-laravel-prerender)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[glhd/conveyor-belt

14797.0k](/packages/glhd-conveyor-belt)[adrianorosa/laravel-geolocation

Laravel Geo Location package to get details for a given IP Address

6593.3k1](/packages/adrianorosa-laravel-geolocation)[bakame/laravel-domain-parser

Laravel package to integrate PHP Domain parser.

26534.8k4](/packages/bakame-laravel-domain-parser)

PHPackages © 2026

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