How to optimize website speed and performance in Laravel 5.5 ?

By Hardik Savani | November 12, 2017 | | 35260 Viewer | Category : PHP Laravel

It is very important for every website to quick load that means your website should load in few seconds like 4 or 5. We are always fetching issues about page speed like how to increase website speed in laravel, how to reduce loading time of website in laravel, is it possible speed up php execution time of my website, how to optimize php laravel script to increase speed, how to speed up web browsing in laravel. So basically you have several question regarding to improve your website performance in laravel.

However, There are several composer packages available for increase website page speed in php laravel. So here i found "laravel-page-speed" composer package for 35%+ optimization of your website.

laravel-page-speed package will minify HTML output and it can be optimization your web page. laravel-page-speed package will delete unused attributes in HTML tags, delete unused quotes in HTML tags, delete unused prefixes from URLs, delete unused whitespace in HTML, delete HTML comments. Also there are several feature. They also minify css and minify js files. There are several things done with this page and i am sure it make better performance at it was before.

Here, i will give you very small example with screen shot. I created simple bootstrap file and with simple table. If i see in "CTRL + u" and see source code then i can see too many white space and if anything unused attribute etc. After used this package you can see on source all white space remove and clean with quick run code.

So here i attach both small and simple example screen shot, so you can understand how it can help you. After that you can see how it works.



As you can see how it optimization and help you. So just follow few step and get simple example:

Step 1: Install laravel-page-speed Composer Package

first thing is that we have to add laravel-page-speed package for improve page speed so one your cmd or terminal and fire bellow command, Make sure laravel-page-speed package support laravel 5.3, laravel 5.4, laravel 5.5 and laravel 5.5 + version of laravel.

composer require renatomarinho/laravel-page-speed

After successfully install package, open config/app.php file and add service provider and alias.


'providers' => [





You can publish the default configuration file by following command:

php artisan vendor:publish --provider="RenatoMarinho\LaravelPageSpeed\ServiceProvider"

After that you have to register your middleware on Kernel.php file so, do like as bellow:



namespace App\Http;

use Illuminate\Foundation\Http\Kernel as HttpKernel;

class Kernel extends HttpKernel




* The application's route middleware groups.


* @var array


protected $middlewareGroups = [

'web' => [














Step 2: Make Route

In this is step we need to create route display simple layout file. so open your routes/web.php file and add following route.


Route::get('mySource', function () {

return view('mySource');


Step 3: Create Blade File

In Last step, let's create mySource.blade.php(resources/views/mySource.blade.php) for layout and we will write design code here and put following code:


<!DOCTYPE html>



<title>My Source</title>

<link rel="stylesheet" href="" />



<div class="container">

<h1>My Source</h1>

<table class="table table-bordered sortable">







































Now, you are ready to run example.

You can get more information about laravel-page-speed plugin from here : laravel-page-speed

I hope it can help you....

***Do you want me hire for your Project Work? Then Contact US.

We are Recommending you: