PHPackages                             googleshokry/laravel-page-speed - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. googleshokry/laravel-page-speed

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

googleshokry/laravel-page-speed
===============================

Laravel Page Speed

241PHP

Since Oct 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/googleshokry/laravel-page-speed)[ Packagist](https://packagist.org/packages/googleshokry/laravel-page-speed)[ RSS](/packages/googleshokry-laravel-page-speed/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Page Speed
==================

[](#laravel-page-speed)

[![Project on GitScrum](https://camo.githubusercontent.com/93635724317c57d27aff1850bf9e8ab597e2676471df8f7554f8f4d44f0945b0/68747470733a2f2f676974736372756d2e636f6d2f6261646765732f70726f6a6563742e7376673f70726f6a6563743d676974736372756d2f62756c6c732d6579652d676974736372756d2d3337)](https://gitscrum.com)[![Laravel 5.3](https://camo.githubusercontent.com/a7e1cdf9092e9addc80026f4f37eb963e539defda9a1f3276d088424c84e0a4b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e332d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 5.4](https://camo.githubusercontent.com/00fa09e19cad4128ef5cee38a4f2ecafffa3a629241ce7481e483c617a2c54bc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e342d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Laravel 5.5](https://camo.githubusercontent.com/1bd291589054cd0fea96c97b26e57f7dfd024f3d20572a13a74a64e37aa053d6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d352e352d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![Build Status](https://camo.githubusercontent.com/6aee3e7df770e4b1ef9df3feeaec8bd7a10199345f6402d591a9413c951e0220/68747470733a2f2f7472617669732d63692e6f72672f676f6f676c6573686f6b72792f6c61726176656c2d706167652d73706565642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/googleshokry/laravel-page-speed)[![License](https://camo.githubusercontent.com/49f9a1e5d9bc9925c7b28df40cdc035dd905c3a9df15ac5e46742fed612541ee/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c6573686f6b72792f6c61726176656c2d706167652d73706565642f6c6963656e7365)](https://packagist.org/packages/googleshokry/laravel-page-speed)[![Latest Stable Version](https://camo.githubusercontent.com/da2c85ed18a7dd0cbe9f5a48558c4923786a483d63b4aa71b06e9d8cb9d1e76b/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c6573686f6b72792f6c61726176656c2d706167652d73706565642f76657273696f6e)](https://packagist.org/packages/googleshokry/laravel-page-speed)[![Total Downloads](https://camo.githubusercontent.com/422a42c9c50e504562c5bc442e4584dd971f3e65e7fe9de3ec45dfecd6fb270e/68747470733a2f2f706f7365722e707567782e6f72672f676f6f676c6573686f6b72792f6c61726176656c2d706167652d73706565642f646f776e6c6f616473)](https://packagist.org/packages/googleshokry/laravel-page-speed)

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

[](#simple-package-to-minify-html-output-on-demand-which-results-in-a-35-optimization)

Installation is easy
--------------------

[](#installation-is-easy)

You can install the package via composer:

```
$ composer require googleshokry/laravel-page-speed
```

### Laravel 5.5 and up

[](#laravel-55-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

[](#laravel-54-or-53)

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

*This is required for publishing the configuration file:*

#### Publish configuration file

[](#publish-configuration-file)

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

#### Register Middlewares

[](#register-middlewares)

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

```
//app/Http/Kernel.php

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

### Before

[](#before)

[![Before of Laravel Page Speed](https://camo.githubusercontent.com/b0141aa95fae5e66399f5d3dcdb20505e57860a0f80e7dd46b0c0e97ebcdb79b/68747470733a2f2f692e696d6775722e636f6d2f634e334d5759682e706e67)](https://camo.githubusercontent.com/b0141aa95fae5e66399f5d3dcdb20505e57860a0f80e7dd46b0c0e97ebcdb79b/68747470733a2f2f692e696d6775722e636f6d2f634e334d5759682e706e67)

### After

[](#after)

[![After of Laravel Page Speed](https://camo.githubusercontent.com/629e6e0b38a0f6798828033cdb48ec72ea6b22eb5af64a8c50f2f24800f132c1/68747470733a2f2f692e696d6775722e636f6d2f494b574b4c6b4c2e706e67)](https://camo.githubusercontent.com/629e6e0b38a0f6798828033cdb48ec72ea6b22eb5af64a8c50f2f24800f132c1/68747470733a2f2f692e696d6775722e636f6d2f494b574b4c6b4c2e706e67)

Roadmap : Filters
-----------------

[](#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 &lt;style&gt; tags into external files for cacheability NO   outline\_javascript Moves large inline &lt;script&gt; tags into external files for cacheability 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
-------------

[](#configuration)

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

### Disable Service

[](#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

[](#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'
    'assets/*', // Ignore all routes with the 'assets' prefix
];
```

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](https://laravel.com/docs/5.5/responses#file-downloads).

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Renato Marinho](https://github.com/googleshokry)
- [All Contributors](../../contributors)

Inspiration
-----------

[](#inspiration)

#### Mod Page Speed ()

[](#mod-page-speed-httpswwwmodpagespeedcom)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 60.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e96c062494bfb776a10cb236e9b56451617925f7e30828ea8df6e4569c0e5e9d?d=identicon)[googleshokry](/maintainers/googleshokry)

---

Top Contributors

[![joaorobertopb](https://avatars.githubusercontent.com/u/6556083?v=4)](https://github.com/joaorobertopb "joaorobertopb (29 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (5 commits)")[![tswestendorp](https://avatars.githubusercontent.com/u/1061961?v=4)](https://github.com/tswestendorp "tswestendorp (5 commits)")[![kenzouno1](https://avatars.githubusercontent.com/u/1946802?v=4)](https://github.com/kenzouno1 "kenzouno1 (2 commits)")[![saifulwebid](https://avatars.githubusercontent.com/u/1644410?v=4)](https://github.com/saifulwebid "saifulwebid (2 commits)")[![andysnell](https://avatars.githubusercontent.com/u/7006523?v=4)](https://github.com/andysnell "andysnell (1 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")[![swilla](https://avatars.githubusercontent.com/u/304159?v=4)](https://github.com/swilla "swilla (1 commits)")[![googleshokry](https://avatars.githubusercontent.com/u/7471802?v=4)](https://github.com/googleshokry "googleshokry (1 commits)")[![JapSeyz](https://avatars.githubusercontent.com/u/2234034?v=4)](https://github.com/JapSeyz "JapSeyz (1 commits)")

### Embed Badge

![Health badge](/badges/googleshokry-laravel-page-speed/health.svg)

```
[![Health](https://phpackages.com/badges/googleshokry-laravel-page-speed/health.svg)](https://phpackages.com/packages/googleshokry-laravel-page-speed)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
