Skip to content

mixdinternet/laravel-ssr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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 =)

About

Server Side Rendering with Laravel

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages