PHPackages                             asyrafhussin/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. asyrafhussin/laravel-page-speed

ActiveLibrary

asyrafhussin/laravel-page-speed
===============================

Laravel Page Speed

1.8.9(7y ago)1199MITPHPPHP ^5.6 || ^7.0

Since Sep 10Pushed 7y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (5)Versions (25)Used By (0)

### Forked From [renatomarinho/laravel-page-speed](https://github.com/renatomarinho/laravel-page-speed)

[](#forked-from-renatomarinholaravel-page-speed)

Laravel Page Speed \[Support Laravel 5.7\]
==========================================

[](#laravel-page-speed-support-laravel-57)

### 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 search asyrafhussin/laravel-page-speed:1.8.8@dev
```

### 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**: `AsyrafHussin\LaravelPageSpeed\ServiceProvider::class`

*This is required for publishing the configuration file:*

#### Publish configuration file

[](#publish-configuration-file)

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

#### Register Middlewares

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

[![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'
];
```

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/AsyrafHussin)
- [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

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 51.9% 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.

###  Release Activity

Cadence

Every ~25 days

Recently: every ~132 days

Total

24

Last Release

2573d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.6

1.5.2PHP ^5.6 || ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2882b80940e6806e2d0785c834a0c3002013cfdfbd01d26094edc4aaf0df01e0?d=identicon)[AsyrafHussin](/maintainers/AsyrafHussin)

---

Top Contributors

[![joaorobertopb](https://avatars.githubusercontent.com/u/6556083?v=4)](https://github.com/joaorobertopb "joaorobertopb (27 commits)")[![AsyrafHussin](https://avatars.githubusercontent.com/u/10107885?v=4)](https://github.com/AsyrafHussin "AsyrafHussin (10 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 (4 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)")

---

Tags

laravelhtmlminifypage-speedoptmize

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M10](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k5.4k1](/packages/vinkius-labs-laravel-page-speed)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[fitztrev/laravel-html-minify

Minifies the HTML output of Laravel 4 applications

414211.4k](/packages/fitztrev-laravel-html-minify)[ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

36412.6k6](/packages/ultrono-laravel-sitemap)[yocmen/html-minify

Minifies the HTML output of Laravel 5 applications (Originally from https://github.com/fitztrev/laravel-html-minify)

1713.7k](/packages/yocmen-html-minify)

PHPackages © 2026

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