Looking to hire Laravel developers? Try LaraJobs

laravel-page-speed maintained by asyrafhussin

Description
Laravel Page Speed
Author
Last update
2019/04/27 13:02 (dev-master)
License
Links
Downloads
199
Tags

Comments
comments powered by Disqus

Forked From renatomarinho/laravel-page-speed

Laravel Page Speed [Support Laravel 5.7]

Simple package to minify HTML output on demand which results in a 35%+ optimization.

Installation is easy

You can install the package via composer:

$ composer search asyrafhussin/laravel-page-speed:1.8.8@dev

Laravel 5.5 and up

You don't have to do anything else, this package uses the Package Auto-Discovery feature, and should be available as soon as you install it via Composer.

Laravel 5.4 or 5.3

Add the Service Provider to your config/app.php: AsyrafHussin\LaravelPageSpeed\ServiceProvider::class

This is required for publishing the configuration file:

Publish configuration file

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

Register Middlewares

Next, the \AsyrafHussin\LaravelPageSpeed\Middleware\CollapseWhitespace::class and other middleware must be registered in the kernel:

//app/Http/Kernel.php

protected $middleware = [
    ...
    \AsyrafHussin\LaravelPageSpeed\Middleware\InlineCss::class,
    \AsyrafHussin\LaravelPageSpeed\Middleware\ElideAttributes::class,
    \AsyrafHussin\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
    \AsyrafHussin\LaravelPageSpeed\Middleware\RemoveComments::class,
    \AsyrafHussin\LaravelPageSpeed\Middleware\TrimUrls::class,
    \AsyrafHussin\LaravelPageSpeed\Middleware\RemoveQuotes::class,
    \AsyrafHussin\LaravelPageSpeed\Middleware\CollapseWhitespace::class,
]

Before

Before of Laravel Page Speed

After

After of Laravel Page Speed

Roadmap : Filters

Configuration

After installing package, you may need to configure some options.

Disable Service

You would probably like to set up the local environment to get a readable output.

//config/laravel-page-speed.php

//Set this field to false to disable the laravel page speed service.
'enable' => env('LARAVEL_PAGE_SPEED_ENABLE', true),

Skip routes

You would probably like to configure the package to skip some routes.

//config/laravel-page-speed.php

//You can use * as wildcard.
'skip' => [
    '*.pdf', //Ignore all routes with final .pdf
    '*/downloads/*',//Ignore all routes that contain 'downloads'
];

By default this field comes configured with some options, so feel free to configure according to your needs...

Notice: This package skip automatically binary response. See File Downloads.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Credits

Inspiration

Mod Page Speed (https://www.modpagespeed.com/)

License

The MIT License (MIT). Please see License File for more information.