Wed Dec 2019 3 years ago

Vue.JS and Laravel Server Side Rendering (SSR) - Part 2

In this tutorial we'll use the v8 engine and the new V8js php extension to compile javascript code inside our PHP application.
Then we can use this setup to render Vue components in our server side and display them to the user before the javascript even loaded :)

Github Project: https://github.com/AfikDeri/vue-laravel-ssr

Resources:

SSR Pros and Cons: https://ssr.vuejs.org/en/

Install V8 on any machine: https://developers.google.com/v8/build

V8js extension installation on linux: https://github.com/lesstif/v8js-rpm

PECL for Mac: https://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/
PECL for Windows: http://php.net/manual/en/install.pecl.windows.php
PECL on linux: just install php-pear which contains pecl:
$ wget http://pear.php.net/go-pear.phar
$ php go-pear.phar

If you have yum installed:
$ yum install php-pear

Laravel Valet: https://laravel.com/docs/5.6/valet

Enjoy :)