Optimize Laravel website speed

Today, I would like to highlight a laravel package that will hep you to speed up your laravel website.

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.

I found “laravel-page-speed” composer package for 35%+ optimization of laravel 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.

Just grab the package via composer.

 composer require renatomarinho/laravel-page-speed

Publish the configuration file

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

And then register it in Kernel file

//app/Http/Kernel.php

protected $middleware = [
    ...
    \RenatoMarinho\LaravelPageSpeed\Middleware\InlineCss::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\ElideAttributes::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\RemoveComments::class,
    //\RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls::class, 
    //\RenatoMarinho\LaravelPageSpeed\Middleware\RemoveQuotes::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\CollapseWhitespace::class, // Note: This middleware invokes "RemoveComments::class" before it runs.
    \RenatoMarinho\LaravelPageSpeed\Middleware\DeferJavascript::class,
]

And you are good to go.

There are several useful filtering methods that will help you to speed up your website like `RemoveComments, CollapseWhitespace, RemoveQuotes` etc.

You can see more detail in their documentation.

By Yuuma



アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム