mixdinternet / laravel-ssr
Server Side Rendering with Laravel
Requires
- jonnyw/php-phantomjs: 4.*
- laravel/framework: 5.*
This package is not auto-updated.
Last update: 2022-02-01 13:09:31 UTC
README
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
=)