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

ActiveLibrary

ldavidsp/laravel-page-speed
===========================

Laravel Page Speed

v9.0.0(4y ago)13.9kMITPHPPHP ^5.6 || ^7.0 || ^8.0 || ^9.0

Since Sep 10Pushed 3y agoCompare

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

READMEChangelogDependencies (5)Versions (35)Used By (0)

 [![Laravel Page Speed logo](https://raw.githubusercontent.com/renatomarinho/laravel-page-speed/master/art/logo.png)](https://raw.githubusercontent.com/renatomarinho/laravel-page-speed/master/art/logo.png)

[![GitScrum](https://camo.githubusercontent.com/bbbf9a008608a4275238d7de2cb9c3a71c4b61bffd8a3830c8160f3fbf7755c9/68747470733a2f2f736974652e676974736372756d2e636f6d2f6261646765732f70726f6a6563742e7376673f70726f6a6563743d676974736372756d2f62756c6c732d6579652d676974736372756d2d3337)](https://gitscrum.com)[![License](https://camo.githubusercontent.com/f0788a2aafa389fd0a1ee1fb53deba76bb540a670006cbfcfc36a7826ce0f722/68747470733a2f2f706f7365722e707567782e6f72672f72656e61746f6d6172696e686f2f6c61726176656c2d706167652d73706565642f6c6963656e7365)](https://packagist.org/packages/renatomarinho/laravel-page-speed)[![Latest Stable Version](https://camo.githubusercontent.com/b39bfb834b6b3202c481a3dfafc9219455705776302d9f8c0cfb60686d97fbaa/68747470733a2f2f706f7365722e707567782e6f72672f72656e61746f6d6172696e686f2f6c61726176656c2d706167652d73706565642f76657273696f6e)](https://packagist.org/packages/renatomarinho/laravel-page-speed)[![Total Downloads](https://camo.githubusercontent.com/19aa4e4bc82c17c55130423de21e6032c9c2206cb011e6c00532c420f3bb4b06/68747470733a2f2f706f7365722e707567782e6f72672f72656e61746f6d6172696e686f2f6c61726176656c2d706167652d73706565642f646f776e6c6f616473)](https://packagist.org/packages/renatomarinho/laravel-page-speed)

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

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

[](#installation)

You can install the package via composer:

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

### Laravel 5.5 and up

[](#laravel-55-and-up)

Laravel 5.5 and up uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

### Laravel 5.4 or 5.3

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

Add the Service Provider to the providers array in **config/app.php**:

`RenatoMarinho\LaravelPageSpeed\ServiceProvider::class`

*This is required for publishing the configuration file:*

### Publish configuration file

[](#publish-configuration-file)

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

Do not forget to register middlewares
-------------------------------------

[](#do-not-forget-to-register-middlewares)

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

```
//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,
]
```

### 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 'style' tags into external files for cacheability NO   outline\_javascript Moves large inline 'script' 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' and 'streamed' responses. See [File Downloads](https://laravel.com/docs/6.0/responses#file-downloads).

Warning
-------

[](#warning)

**\\RenatoMarinho\\LaravelPageSpeed\\Middleware\\TrimUrls::class** is considered **medium risk**. It can cause problems if it uses the wrong base URL. This can happen, for example, if you serve HTML that will be pasted verbatim into other HTML pages. If URLs are trimmed on the first page, they will be incorrect for the page they are inserted into. In this case, just disable the middleware.

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Renato Marinho](https://github.com/renatomarinho)
- [João Roberto P. Borges](https://github.com/joaorobertopb)
- [Caneco](https://twitter.com/caneco) (for the logo)
- [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

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity92

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 52.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 ~50 days

Recently: every ~131 days

Total

33

Last Release

1541d ago

Major Versions

1.9.0 → 2.x-dev2020-10-31

2.x-dev → 8.0.02020-12-26

8.0.1 → v9.0.02022-02-22

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

1.5.2PHP ^5.6 || ^7.0

2.x-devPHP ^7.1.3

8.0.0PHP ^5.6 || ^7.0 || ^8.0

v9.0.0PHP ^5.6 || ^7.0 || ^8.0 || ^9.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f3a8af21bab573564ef9d8c6653f4e8d5fe360b6ef629a750dc641b1351ea1a?d=identicon)[ldavidsp](/maintainers/ldavidsp)

---

Top Contributors

[![joaorobertopb](https://avatars.githubusercontent.com/u/6556083?v=4)](https://github.com/joaorobertopb "joaorobertopb (37 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)")[![lucasMesquitaBorges](https://avatars.githubusercontent.com/u/42281497?v=4)](https://github.com/lucasMesquitaBorges "lucasMesquitaBorges (5 commits)")[![slzno](https://avatars.githubusercontent.com/u/44006503?v=4)](https://github.com/slzno "slzno (3 commits)")[![renatomarinho](https://avatars.githubusercontent.com/u/26571?v=4)](https://github.com/renatomarinho "renatomarinho (2 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)")[![tvbeek](https://avatars.githubusercontent.com/u/2026498?v=4)](https://github.com/tvbeek "tvbeek (1 commits)")[![patrickbrouwers](https://avatars.githubusercontent.com/u/7728097?v=4)](https://github.com/patrickbrouwers "patrickbrouwers (1 commits)")[![caneco](https://avatars.githubusercontent.com/u/502041?v=4)](https://github.com/caneco "caneco (1 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (1 commits)")[![JapSeyz](https://avatars.githubusercontent.com/u/2234034?v=4)](https://github.com/JapSeyz "JapSeyz (1 commits)")[![nikonor909](https://avatars.githubusercontent.com/u/6659210?v=4)](https://github.com/nikonor909 "nikonor909 (1 commits)")[![andysnell](https://avatars.githubusercontent.com/u/7006523?v=4)](https://github.com/andysnell "andysnell (1 commits)")[![percymamedy](https://avatars.githubusercontent.com/u/11259669?v=4)](https://github.com/percymamedy "percymamedy (1 commits)")[![swilla](https://avatars.githubusercontent.com/u/304159?v=4)](https://github.com/swilla "swilla (1 commits)")

---

Tags

laravelhtmlminifypage-speedoptimize

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/ldavidsp-laravel-page-speed/health.svg)](https://phpackages.com/packages/ldavidsp-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)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)

PHPackages © 2026

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