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

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

cevv13/laravel-page-speed
=========================

Laravel Page Speed

2.1.1(3y ago)09MITPHPPHP ^7.4 || ^8.0

Since Sep 10Pushed 3y agoCompare

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

READMEChangelog (2)Dependencies (5)Versions (33)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)

[![Build Status](https://camo.githubusercontent.com/f5c34e6a46a5b33df0a95eadb1a8ca53bb7c765bff2c7339688568b385f4f761/68747470733a2f2f7472617669732d63692e6f72672f72656e61746f6d6172696e686f2f6c61726176656c2d706167652d73706565642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/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)[![License](https://camo.githubusercontent.com/f0788a2aafa389fd0a1ee1fb53deba76bb540a670006cbfcfc36a7826ce0f722/68747470733a2f2f706f7365722e707567782e6f72672f72656e61746f6d6172696e686f2f6c61726176656c2d706167652d73706565642f6c6963656e7365)](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. Laravel Page Speed was created by [Renato Marinho](https://github.com/renatomarinho), and currently maintained by [João Roberto P. Borges](https://github.com/joaorobertopb), [Lucas Mesquita Borges](https://github.com/lucasMesquitaBorges) and [Renato Marinho](https://github.com/renatomarinho).

Installation
------------

[](#installation)

> **Requires:**

- **[PHP 7.2.5+](https://php.net/releases/)**
- **[Laravel 6.0+](https://github.com/laravel/laravel)**

You can install the package via composer:

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

This package supports Laravel [Package Discovery](https://laravel.com/docs/6.0/packages#package-discovery).

### 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, for example:

```
//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, // Note: This middleware invokes "RemoveComments::class" before it runs.
    \RenatoMarinho\LaravelPageSpeed\Middleware\DeferJavascript::class,
]
```

Middlewares Details
-------------------

[](#middlewares-details)

### \\RenatoMarinho\\LaravelPageSpeed\\Middleware\\RemoveComments::class

[](#renatomarinholaravelpagespeedmiddlewareremovecommentsclass)

The **RemoveComments::class** filter eliminates HTML, JS and CSS comments. The filter reduces the transfer size of HTML files by removing the comments. Depending on the HTML file, this filter can significantly reduce the number of bytes transmitted on the network.

### \\RenatoMarinho\\LaravelPageSpeed\\Middleware\\CollapseWhitespace::class

[](#renatomarinholaravelpagespeedmiddlewarecollapsewhitespaceclass)

The **CollapseWhitespace::class** filter reduces bytes transmitted in an HTML file by removing unnecessary whitespace. This middleware invoke **RemoveComments::class** filter before executation.

> **Note**: Do not register the "RemoveComments::class" filter with it. Because it will be called automatically by "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)

### \\RenatoMarinho\\LaravelPageSpeed\\Middleware\\RemoveQuotes::class

[](#renatomarinholaravelpagespeedmiddlewareremovequotesclass)

The **RemoveQuotes::class** filter eliminates unnecessary quotation marks from HTML attributes. While required by the various HTML specifications, browsers permit their omission when the value of an attribute is composed of a certain subset of characters (alphanumerics and some punctuation characters).

Quote removal produces a modest savings in byte count on most pages.

### \\RenatoMarinho\\LaravelPageSpeed\\Middleware\\ElideAttributes::class

[](#renatomarinholaravelpagespeedmiddlewareelideattributesclass)

The **ElideAttributes::class** filter reduces the transfer size of HTML files by removing attributes from tags when the specified value is equal to the default value for that attribute. This can save a modest number of bytes, and may make the document more compressible by canonicalizing the affected tags.

### \\RenatoMarinho\\LaravelPageSpeed\\Middleware\\InsertDNSPrefetch::class

[](#renatomarinholaravelpagespeedmiddlewareinsertdnsprefetchclass)

The **InsertDNSPrefetch::class** filter Injects tags in the HEAD to enable the browser to do DNS prefetching.

DNS resolution time varies from &lt;1ms for locally cached results, to hundreds of milliseconds due to the cascading nature of DNS. This can contribute significantly towards total page load time. This filter reduces DNS lookup time by providing hints to the browser at the beginning of the HTML, which allows the browser to pre-resolve DNS for resources on the page.

### ⚠️ \\RenatoMarinho\\LaravelPageSpeed\\Middleware\\TrimUrls::class,

[](#️-renatomarinholaravelpagespeedmiddlewaretrimurlsclass)

The **TrimUrls::class** filter trims URLs by resolving them by making them relative to the base URL for the page.

> **Warning**: **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.

### \\RenatoMarinho\\LaravelPageSpeed\\Middleware\\InlineCss::class

[](#renatomarinholaravelpagespeedmiddlewareinlinecssclass)

The **InlineCss::class** filter transforms the inline "style" attribute of tags into classes by moving the CSS to the header.

### \\RenatoMarinho\\LaravelPageSpeed\\Middleware\\DeferJavascript::class

[](#renatomarinholaravelpagespeedmiddlewaredeferjavascriptclass)

Defers the execution of javascript in the HTML.

> If necessary cancel deferring in some script, use `data-pagespeed-no-defer` as script attribute to cancel deferring.

---

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).

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

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

Contributors
------------

[](#contributors)

- [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

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 53% 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 ~56 days

Recently: every ~195 days

Total

32

Last Release

1421d ago

Major Versions

1.9.0 → 2.0.02021-01-15

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

1.5.2PHP ^5.6 || ^7.0

2.0.0PHP ^7.2.5 || ^8.0

2.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/9b630a236165fbb70eb550890a70e0c31fff064a2a23c16fc05ccbbfd42b257f?d=identicon)[cevv13](/maintainers/cevv13)

---

Top Contributors

[![joaorobertopb](https://avatars.githubusercontent.com/u/6556083?v=4)](https://github.com/joaorobertopb "joaorobertopb (62 commits)")[![lucasMesquitaBorges](https://avatars.githubusercontent.com/u/42281497?v=4)](https://github.com/lucasMesquitaBorges "lucasMesquitaBorges (19 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (5 commits)")[![stakahashi](https://avatars.githubusercontent.com/u/3667416?v=4)](https://github.com/stakahashi "stakahashi (5 commits)")[![tswestendorp](https://avatars.githubusercontent.com/u/1061961?v=4)](https://github.com/tswestendorp "tswestendorp (5 commits)")[![cevv13](https://avatars.githubusercontent.com/u/19509545?v=4)](https://github.com/cevv13 "cevv13 (4 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)")[![swilla](https://avatars.githubusercontent.com/u/304159?v=4)](https://github.com/swilla "swilla (1 commits)")[![tvbeek](https://avatars.githubusercontent.com/u/2026498?v=4)](https://github.com/tvbeek "tvbeek (1 commits)")[![nikonor909](https://avatars.githubusercontent.com/u/6659210?v=4)](https://github.com/nikonor909 "nikonor909 (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)")[![f-liva](https://avatars.githubusercontent.com/u/346224?v=4)](https://github.com/f-liva "f-liva (1 commits)")[![JapSeyz](https://avatars.githubusercontent.com/u/2234034?v=4)](https://github.com/JapSeyz "JapSeyz (1 commits)")[![lakuapik](https://avatars.githubusercontent.com/u/20186786?v=4)](https://github.com/lakuapik "lakuapik (1 commits)")[![andysnell](https://avatars.githubusercontent.com/u/7006523?v=4)](https://github.com/andysnell "andysnell (1 commits)")[![patrickbrouwers](https://avatars.githubusercontent.com/u/7728097?v=4)](https://github.com/patrickbrouwers "patrickbrouwers (1 commits)")[![percymamedy](https://avatars.githubusercontent.com/u/11259669?v=4)](https://github.com/percymamedy "percymamedy (1 commits)")

---

Tags

laravelhtmlminifypage-speedoptimize

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[vinkius-labs/laravel-page-speed

Laravel Page Speed

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

Laravel Page Speed

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

JavaScript WYSIWYG web text editor (for laravel).

377762.3k5](/packages/unisharp-laravel-ckeditor)[erlandmuchasaj/laravel-gzip

Gzip your responses.

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

PHPackages © 2026

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