Looking to hire Laravel developers? Try LaraJobs

laravel-ssr maintained by mixdinternet

Description
Server Side Rendering with Laravel
Last update
2017/09/05 14:39 (dev-master)
License
Links
Downloads
43

Comments
comments powered by Disqus

Server Side Rendering with Laravel + Phantomjs

Total Downloads Latest Stable Version License

Did someone say Server Side Rendering with Laravel?

This package adds a middleware on your Laravel websites that capture GET requests with _escaped_fragment_. The url will be rendering with Phantomjs and will be cached with Laravel Cache Drive

To make the magic, just add <meta name="fragment" content="!"> to the <head> of all pages that you want to be indexed. (maybe master.blade.php)

More info about escaped_fragment

Dependencies

Installation

You can install this package via composer

  composer require mixdinternet/laravel-ssr

In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in config/app.php file:

'providers' => [
    ...
    Mixdinternet\SSR\Providers\SSRServiceProvider::class,
];

You can publish the config file with:

php artisan vendor:publish --provider="Mixdinternet\SSR\Providers\SSRServiceProvider" --tag="config"

Phantomjs Instalation

Get your copy of Phantomjs here

Extract the file and put the content of bin folder in storage/app

It will looks like something like this storage/app/phantonjs

Don't worry, you can change this in config/ssr.php =)