2017 © Pedro Peláez
 

library laravel-page-speed

Laravel Page Speed

image

asyrafhussin/laravel-page-speed

Laravel Page Speed

  • Thursday, February 8, 2018
  • by AsyrafHussin
  • Repository
  • 1 Watchers
  • 0 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 107 Forks
  • 0 Open issues
  • 23 Versions
  • 15 % Grown

The README.md

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:, (*1)

$ 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., (*2)

Laravel 5.4 or 5.3

Add the Service Provider to your config/app.php: AsyrafHussin\LaravelPageSpeed\ServiceProvider::class, (*3)

This is required for publishing the configuration file:, (*4)

Publish configuration file

php artisan vendor:publish --provider="AsyrafHussin\LaravelPageSpeed\ServiceProvider", (*5)

Register Middlewares

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

//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, (*7)

After

After of Laravel Page Speed, (*8)

Roadmap : Filters

Name Description Available
inline_css Inlines small external CSS files YES
elide_attributes Removes unnecessary attributes in HTML tags YES
insert_dns_prefetch Injects tags in the HEAD to enable the browser to do DNS prefetching YES
remove_quotes Removes unnecessary quotes in HTML tags YES
trim_urls Removes unnecessary prefixes from URLs YES
collapse_whitespace Removes unnecessary whitespace in HTML YES
remove_comments Removes HTML comments YES
combine_css Combines multiple CSS files into one NO
combine_heads Combines multiple elements into one NO
combine_javascript Combines multiple JavaScript files into one NO
dedup_inlined_images Replaces repeated inlined images with JavaScript that loads the data from the first instance of the image NO
defer_javascript Defers the execution of javascript in the HTML NO
pedantic Adds default type attributes to script and style tags that are missing them NO
extend_cache Improves cacheability NO
fallback_rewrite_css_urls Rewrite URLs in CSS even if CSS is not parseable NO
flatten_css_imports Flattens @import rules in CSS by replacing the rule with the contents of the imported resource NO
hint_preload_subresources Inserts link: headers to preload CSS and JavaScript resources NO
inline_google_font_css Inlines small font-loading CSS from Google Fonts API NO
inline_import_to_link Inlines style tags comprising only CSS @imports by converting them to an equivalent link NO
inline_javascript Inlines small external Javascript files NO
inline_preview_images Delays original images; serves inlined, low-quality placeholder images until originals are loaded NO
insert_ga Inserts Google Analytics javascript snippet NO
lazyload_images Loads images when they become visible in the client viewport NO
local_storage_cache Loads inlined CSS and image resources into HTML5 local storage whence the client fetches them subsequently rather than the server sending them again NO
make_show_ads_async Converts synchronous Google AdSense tags to asynchronous format NO
make_google_analytics_async Converts synchronous Google Analytics code to load asynchronously NO
move_css_above_scripts Moves CSS above scripts NO
move_css_to_head Moves CSS into the element NO
outline_css Moves large inline NO
outline_javascript Moves large inline NO
prioritize_critical_css Instruments the page, inlines its critical CSS at the top, and lazily loads the rest NO
resize_mobile_images Just like inline_preview_images, but uses smaller placeholder images for mobile browsers NO
resize_rendered_image_dimensions Resize images to rendered dimensions NO
responsive_images Serve responsive images using the srcset attribute NO
rewrite_css Minifies CSS NO
rewrite_images Rescales, and compresses images; inlines small ones NO
rewrite_javascript Minifies Javascript NO
rewrite_style_attributes Rewrite the CSS in style attributes by applying the configured rewrite_css filter to it NO
rewrite_style_attributes_with_url Rewrite the CSS in style attributes by applying the configured rewrite_css filter to it, but only if the attribute contains the text 'url(' NO
sprite_images Sprites images NO

Configuration

After installing package, you may need to configure some options., (*9)

Disable Service

You would probably like to set up the local environment to get a readable output., (*10)

//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., (*11)

//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..., (*12)

Notice: This package skip automatically binary response. See File Downloads., (*13)

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details., (*14)

Credits

Inspiration

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

License

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

The Versions

08/02 2018

dev-master

9999999-dev

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Asyraf Hussin

laravel html minify page speed optmize

08/02 2018

1.8.7

1.8.7.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

by Asyraf Hussin

laravel html minify page speed optmize

02/12 2017

1.8.6

1.8.6.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

12/11 2017

1.8.5

1.8.5.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

03/11 2017

1.8.4

1.8.4.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

20/10 2017

1.8.3

1.8.3.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

20/10 2017

1.8.2

1.8.2.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

18/10 2017

1.8.1

1.8.1.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

16/10 2017

1.8.0

1.8.0.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

14/10 2017

1.7.0

1.7.0.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

13/10 2017

1.6.0

1.6.0.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

07/10 2017

1.5.5

1.5.5.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

02/10 2017

1.5.4

1.5.4.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

02/10 2017

1.5.3

1.5.3.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

01/10 2017

1.5.2

1.5.2.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

28/09 2017

1.5.1

1.5.1.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

24/09 2017

1.5.0

1.5.0.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

24/09 2017

1.4.0

1.4.0.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

24/09 2017

1.3.0

1.3.0.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

23/09 2017

1.2.0

1.2.0.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

14/09 2017

1.1.0

1.1.0.0

Laravel Page Speed

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html minify page speed optmize

12/09 2017

1.0.1

1.0.1.0

Laravel Blade Minify HTML

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html blade minify

10/09 2017

1.0.0

1.0.0.0

Laravel Blade Minify HTML

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel html blade minify