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

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

snowsoft/laravel-page-speed
===========================

Laravel Page Speed

v4.00(3mo ago)052↓86.1%MITPHPCI passing

Since Sep 12Pushed 1mo agoCompare

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

READMEChangelog (1)Dependencies (5)Versions (36)Used By (0)

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

 [![Latest Version](https://camo.githubusercontent.com/0fcf638de7fd367c37dca1170733e5ed277e8880be81a7c65fa73cdbed3041dd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736e6f77736f66742f6c61726176656c2d706167652d73706565643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/snowsoft/laravel-page-speed) [![Total Downloads](https://camo.githubusercontent.com/40917b0dff028d4f18f311e95f8b7e123bdbb3e48bd4a3c31026547472ed2613/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72656e61746f6d6172696e686f2f6c61726176656c2d706167652d73706565643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/renatomarinho/laravel-page-speed) [![Daily Downloads](https://camo.githubusercontent.com/8039cfc7c17ef56dc05b1112548be34537f702c6b7e4faf13c3653146b7d85a1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f736e6f77736f66742f6c61726176656c2d706167652d73706565643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/snowsoft/laravel-page-speed) [![License](https://camo.githubusercontent.com/2d8bb165da0f9445cb856e9f95db736f9a7206863a9dc57e84ef3eea87c53ad2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736e6f77736f66742f6c61726176656c2d706167652d73706565643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/snowsoft/laravel-page-speed) [![GitHub Stars](https://camo.githubusercontent.com/9af1fefe8eac448ef439fdd5232c640ca49dd176a1f344480d93433a0a79baac/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f736e6f77736f66742f6c61726176656c2d706167652d73706565643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/snowsoft/laravel-page-speed) [![PHP Version](https://camo.githubusercontent.com/faee4de59456b32d5612fc2710529e028c793212493f9d0c7eea08f3e91f4a29/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736e6f77736f66742f6c61726176656c2d706167652d73706565643f7374796c653d666c61742d737175617265)](https://packagist.org/packages/snowsoft/laravel-page-speed)

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

[](#laravel-page-speed)

Laravel Page Speed delivers an end-to-end optimization pipeline for Blade-rendered pages and REST APIs with measurable gains in latency, bandwidth, and resiliency.

Table of Contents
-----------------

[](#table-of-contents)

- [Overview](#overview)
- [Optimization Pipelines](#optimization-pipelines)
- [Quick Integration](#quick-integration)
- [Measured Impact](#measured-impact)
- [Observability and Resilience](#observability-and-resilience)
- [Documentation Suite](#documentation-suite)
- [Contributing and Support](#contributing-and-support)

Overview
--------

[](#overview)

- **Dual scope**: optimizes rendered HTML and JSON/XML payloads without modifying your business payloads.
- **Composable stack**: enable only the middleware you need through `config/laravel-page-speed.php`.
- **Store-agnostic**: works with Redis, Memcached, DynamoDB (via cache tags), file, or array drivers across Laravel 10–13.
- **Built for observability**: exposes latency, memory usage, cache hits, and circuit status via standard HTTP headers.

Optimization Pipelines
----------------------

[](#optimization-pipelines)

### Web (HTML/Blade)

[](#web-htmlblade)

- Structured HTML minification and comment stripping that stay compatible with Bootstrap, Tailwind, and Livewire.
- Targeted critical CSS inlining to reduce render-blocking round trips.
- Script deferral and DNS prefetching that maintain execution order through `data-ps-*` guards.

### APIs (REST/JSON)

[](#apis-restjson)

- Adaptive compression (Brotli first, Gzip fallback) with configurable size thresholds to avoid overhead on small payloads.
- Response caching with method-aware invalidation, dynamic tag derivation per path segment, and hit-rate metrics.
- Pre-hardened security headers (HSTS, CSP, Permissions-Policy) and an automatic circuit breaker with customizable fallbacks.
- Lightweight health check middleware designed for Kubernetes probes and service orchestrators.

Quick Integration
-----------------

[](#quick-integration)

### Web Middleware

[](#web-middleware)

Choose the registration pattern that matches your Laravel install:

**Laravel 10.x (`app/Http/Kernel.php`)**

Append the middleware inside the `web` group so the order stays deterministic:

```
protected $middlewareGroups = [
    'web' => [
        // ... existing middleware
        \Snowsoft\LaravelPageSpeed\Middleware\InlineCss::class,
        \Snowsoft\LaravelPageSpeed\Middleware\ElideAttributes::class,
        \Snowsoft\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
        \Snowsoft\LaravelPageSpeed\Middleware\CollapseWhitespace::class,
        \Snowsoft\LaravelPageSpeed\Middleware\DeferJavascript::class,
    ],
];
```

**Laravel 11.x, 12.x and 13.x (`bootstrap/app.php`)**

Use the middleware configurator introduced in Laravel 11. Extend the existing `->withMiddleware` closure:

```
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: __DIR__.'/../')
    // ... existing configuration
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->appendToGroup('web', [
            \Snowsoft\LaravelPageSpeed\Middleware\InlineCss::class,
            \Snowsoft\LaravelPageSpeed\Middleware\ElideAttributes::class,
            \Snowsoft\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
            \Snowsoft\LaravelPageSpeed\Middleware\CollapseWhitespace::class,
            \Snowsoft\LaravelPageSpeed\Middleware\DeferJavascript::class,
        ]);

        // keep other group definitions (api, broadcast, etc.) here
    })
    ->create();
```

### API Middleware

[](#api-middleware)

Attach only the middleware that fits your API architecture.

**Laravel 10.x (`app/Http/Kernel.php`)**

```
protected $middlewareGroups = [
    'api' => [
        // ... existing middleware
        \Snowsoft\LaravelPageSpeed\Middleware\ApiSecurityHeaders::class,
        \Snowsoft\LaravelPageSpeed\Middleware\ApiResponseCache::class,
        \Snowsoft\LaravelPageSpeed\Middleware\ApiETag::class,
        \Snowsoft\LaravelPageSpeed\Middleware\ApiResponseCompression::class,
        \Snowsoft\LaravelPageSpeed\Middleware\ApiPerformanceHeaders::class,
        \Snowsoft\LaravelPageSpeed\Middleware\ApiCircuitBreaker::class,
        \Snowsoft\LaravelPageSpeed\Middleware\ApiHealthCheck::class,
    ],
];
```

**Laravel 11.x, 12.x and 13.x (`bootstrap/app.php`)**

Inside the same `->withMiddleware` closure from the Web section, append the API stack:

```
$middleware->appendToGroup('api', [
    \Snowsoft\LaravelPageSpeed\Middleware\ApiSecurityHeaders::class,
    \Snowsoft\LaravelPageSpeed\Middleware\ApiResponseCache::class,
    \Snowsoft\LaravelPageSpeed\Middleware\ApiETag::class,
    \Snowsoft\LaravelPageSpeed\Middleware\ApiResponseCompression::class,
    \Snowsoft\LaravelPageSpeed\Middleware\ApiPerformanceHeaders::class,
    \Snowsoft\LaravelPageSpeed\Middleware\ApiCircuitBreaker::class,
    \Snowsoft\LaravelPageSpeed\Middleware\ApiHealthCheck::class,
]);
```

### Publish assets and baseline environment variables

[](#publish-assets-and-baseline-environment-variables)

```
composer require snowsoft/laravel-page-speed
php artisan vendor:publish --provider="Snowsoft\\LaravelPageSpeed\\ServiceProvider"
```

Recommended baseline for cached APIs:

```
LARAVEL_PAGE_SPEED_ENABLE=true
API_CACHE_ENABLED=true
API_CACHE_DRIVER=redis
API_CACHE_TTL=300
API_CACHE_DYNAMIC_TAGS=true
```

Measured Impact
---------------

[](#measured-impact)

MetricBeforeAfter (cache hit)DeltaPage Size (Blade)245 KB159 KB-35%First Paint1.8 s1.2 s-33%API Payload15.2 KB2.8 KB-82%Average API Latency450 ms2 ms-99.6%SQL Queries (100-item list)350-100%Monthly Bandwidth (estimate)15 TB3 TB-80%Reference scenario: 1M requests/day with a 65% cache hit rate.

Observability and Resilience
----------------------------

[](#observability-and-resilience)

- **Performance headers**: `X-Response-Time`, `X-Memory-Usage`, `X-Cache-Status`, `X-Circuit-Breaker-State` ready for ingestion by Datadog, New Relic, or Prometheus scrapers.
- **Configurable circuit breaker**: customize failure thresholds, timeout, and scope (route, endpoint, or path) via configuration.
- **Adaptive health check**: aggregates database, cache, disk, and queue probes with optional 10-second result caching.
- **Debug-aware skipping**: curated `skip` patterns avoid instrumenting Debugbar, Telescope, Horizon, or custom diagnostic routes.

Documentation Suite
-------------------

[](#documentation-suite)

- [Documentation Hub](docs/README.md)
- [Web Optimization](docs/WEB-OPTIMIZATION.md)
- [API Optimization](docs/API-OPTIMIZATION.md)
- [Cache Architecture](docs/API-CACHE.md)
- [Configuration Reference](docs/CONFIGURATION.md)
- [Scenario Playbooks](docs/API-EXAMPLES.md)
- [Executive Summary](docs/PACKAGE-SUMMARY.md)

Contributing and Support
------------------------

[](#contributing-and-support)

- Review [CONTRIBUTING.md](CONTRIBUTING.md) before opening pull requests.
- Run `composer test` (or `docker compose exec app vendor/bin/phpunit`) prior to submitting changes.
- File issues and start discussions via [GitHub Issues](../../issues) and [Discussions](../../discussions).
- Distributed under the [MIT license](LICENSE.md).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance86

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~92 days

Recently: every ~381 days

Total

35

Last Release

51d ago

Major Versions

1.9.0 → 2.0.02021-01-15

v2.00 → v3.002025-03-17

v3.00 → v4.002026-03-18

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

1.5.2PHP ^5.6 || ^7.0

2.0.0PHP ^7.2.5 || ^8.0

v2.00PHP ^8.2

v3.00PHP ^8.3

v1.0.0PHP ^8.1 || ^8.2 || ^8.3 || ^8.4 || ^8.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4568234?v=4)[snowsoft](/maintainers/snowsoft)[@snowsoft](https://github.com/snowsoft)

---

Top Contributors

[![joaorobertopb](https://avatars.githubusercontent.com/u/6556083?v=4)](https://github.com/joaorobertopb "joaorobertopb (63 commits)")[![renatomarinho](https://avatars.githubusercontent.com/u/26571?v=4)](https://github.com/renatomarinho "renatomarinho (48 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)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![snowsoft](https://avatars.githubusercontent.com/u/4568234?v=4)](https://github.com/snowsoft "snowsoft (4 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 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)")[![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)")[![caneco](https://avatars.githubusercontent.com/u/502041?v=4)](https://github.com/caneco "caneco (1 commits)")[![tvbeek](https://avatars.githubusercontent.com/u/2026498?v=4)](https://github.com/tvbeek "tvbeek (1 commits)")[![swilla](https://avatars.githubusercontent.com/u/304159?v=4)](https://github.com/swilla "swilla (1 commits)")[![andysnell](https://avatars.githubusercontent.com/u/7006523?v=4)](https://github.com/andysnell "andysnell (1 commits)")[![DmytroGural](https://avatars.githubusercontent.com/u/268188117?v=4)](https://github.com/DmytroGural "DmytroGural (1 commits)")[![gofish543](https://avatars.githubusercontent.com/u/10394554?v=4)](https://github.com/gofish543 "gofish543 (1 commits)")[![f-liva](https://avatars.githubusercontent.com/u/346224?v=4)](https://github.com/f-liva "f-liva (1 commits)")

---

Tags

laravelhtmlminifypage-speedoptimize

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[renatomarinho/laravel-page-speed

Laravel Page Speed

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

Laravel Page Speed

2.5k9.6k1](/packages/vinkius-labs-laravel-page-speed)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[erlandmuchasaj/laravel-gzip

Gzip your responses.

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

PHPackages © 2026

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