PHPackages                             stannlee/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. stannlee/laravel-prerender

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

stannlee/laravel-prerender
==========================

Prerender middleware for spas created with laravel

v1.0.4(3y ago)41.8k[2 PRs](https://github.com/StanleyMasinde/laravel-prerender/pulls)MITPHPPHP ^7.2.5

Since Feb 23Pushed 3y agoCompare

[ Source](https://github.com/StanleyMasinde/laravel-prerender)[ Packagist](https://packagist.org/packages/stannlee/laravel-prerender)[ RSS](/packages/stannlee-laravel-prerender/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (11)Used By (0)

#### For Laravel 5 and below, use the [Original Repo](https://github.com/JeroenNoten/Laravel-Prerender)

[](#for-laravel-5-and-below-use-the-original-repo)

[![Codacy Badge](https://camo.githubusercontent.com/1c60668abc8d1193e2639e9fa85002fed947eda8a778599f2b1f182f8544c887/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3264313463333639623038343438393061666539393064353062643830393735)](https://app.codacy.com/manual/stanleyloren/laravel-prerender?utm_source=github.com&utm_medium=referral&utm_content=stannlee/laravel-prerender&utm_campaign=Badge_Grade_Dashboard)

===========================

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.

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

[](#installation)

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

The package registers it's service provider

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:port

```

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/'
],
```

Credits to the Orginal Creator [Jeroen Noten](https://github.com/JeroenNoten).
==============================================================================

[](#credits-to-the-orginal-creator-jeroen-noten)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.6% 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 ~120 days

Recently: every ~210 days

Total

8

Last Release

1425d ago

Major Versions

0.0.4 → 1.0.02020-03-04

PHP version history (2 changes)0.0.1PHP ^7.2

1.0.0PHP ^7.2.5

### Community

Maintainers

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

---

Top Contributors

[![StanleyMasinde](https://avatars.githubusercontent.com/u/35426405?v=4)](https://github.com/StanleyMasinde "StanleyMasinde (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")

---

Tags

laravelprerender

### Embed Badge

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

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

###  Alternatives

[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[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)[pulkitjalan/ip-geolocation

IP Geolocation Wrapper with Laravel Support

89164.9k1](/packages/pulkitjalan-ip-geolocation)[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)
