Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Page Speed Laravel Package

vinkius-labs/laravel-page-speed

Optimize Laravel HTML and API responses with a configurable middleware pipeline: minify HTML/JSON/XML, add cache headers, ETags, compression and more. Works across Laravel 10โ€“13 with any cache store (Redis, Memcached, file, etc.) for faster, leaner responses.

View on GitHub
Deep Wiki
Context7
4.4.3

Fixed

  • ๐Ÿ› ApiCircuitBreaker: Fixed cache driver inconsistency โ€” circuit breaker state now uses the configured API_CACHE_DRIVER instead of the default cache driver, ensuring consistent state sharing in distributed environments.
  • ๐Ÿ› ApiPerformanceHeaders: Fixed X-Performance-Warning header being silently overwritten when both high query count and slow request conditions triggered simultaneously. Both warnings are now combined.
  • ๐Ÿ› ApiHealthCheck: Fixed queue health check returning a false positive ok status without actually probing the queue driver. Now calls Queue::connection()->size() to verify connectivity.
  • ๐Ÿ› ApiETag: Fixed unconditional Cache-Control header overwrite that could conflict with application-level or other middleware caching directives. Now respects existing headers.
  • ๐Ÿ› ApiResponseCache: Removed unnecessary new Response() instantiation in shouldCache() โ€” uses isEnable() directly.

Changed

  • ๐Ÿ›ก๏ธ PageSpeed Base: Added Content-Type guard in the base handle() method โ€” web middleware now skips non-HTML responses (application/json, application/xml, etc.), preventing silent data corruption on misconfigured middleware groups.
  • ๐Ÿ›ก๏ธ TrimUrls: Protocol stripping (https:, http:) is now limited to src, href, and action attributes only, preventing corruption of JavaScript strings, meta tags, and SVG namespaces.
  • ๐Ÿ›ก๏ธ ApiSecurityHeaders: Changed X-XSS-Protection from deprecated 1; mode=block to 0 as recommended by MDN, relying on CSP for XSS protection instead.
  • ๐Ÿ“ฆ composer.json: Simplified PHP version constraint from ^8.2 || ^8.3 to ^8.2, which correctly covers PHP 8.2, 8.3, 8.4, and future 8.x releases.
4.4.2

Fixed

  • ๐Ÿ› PageSpeed Base Class: Fixed PCRE stack exhaustion and blank pages in replaceInsideHtmlTags by utilizing the s (PCRE_DOTALL) modifier to avoid nested groups, and added fallback to original content to prevent page breaks on regex failures.
  • ๐Ÿ› CollapseWhitespace Middleware: Fixed issue where Livewire and Alpine.js attributes (wire:snapshot, wire:effects, x-data, x-init) were corrupted during minification by explicitly preserving them.

Changed

  • โšก CollapseWhitespace Middleware: Optimized restorePreservedContent by replacing foreach + str_replace loop with native strtr(), significantly improving performance on large HTML payloads.
4.4.1

Fixed

  • ๐Ÿ› RemoveComments Middleware: Removed broken logPerformanceMetrics() call that passed pre-computed elapsed time instead of raw start time, resulting in wildly inaccurate debug metrics (~1.7 billion ms). The parent PageSpeed::handle() already provides correct, debug-only performance logging.
  • ๐Ÿ› InlineCss Middleware: Fixed state leak across requests in persistent environments (Laravel Octane, Swoole). Instance properties $class, $style, and $inline are now reset at the beginning of each apply() call.
  • ๐Ÿ› PageSpeed Base Class: Removed stale static $isEnabled cache that was never cleared, causing runtime configuration changes to be silently ignored in persistent environments.
  • ๐Ÿ› ApiResponseCache Middleware: Removed orphaned docblock for a deleted supportsTags() method and corrected invalidateCache() return type from [@return](https://github.com/return) void to [@return](https://github.com/return) bool.
  • ๐Ÿ› Config: Removed duplicate *.doc entry in the skip list.

Changed

  • ๐Ÿงช Updated ConfigTest to validate correct behavior: isEnable() now reflects runtime configuration changes instead of returning a stale cached value.
4.4.0

Added

  • โœ… Laravel 13.x support (#215 by @laravel-shift)
  • โœ… PHPUnit 12.x support (^12.5.12)
  • โœ… Orchestra Testbench 11.x support

Changed

  • ๐Ÿ“ฆ Updated illuminate/support constraint to ^10.0 || ^11.0 || ^12.0 || ^13.0
  • ๐Ÿ“ฆ Updated phpunit/phpunit constraint to ^10.5 || ^11.0 || ^12.5.12
  • ๐Ÿ“ฆ Updated orchestra/testbench constraint to ^8.0 || ^9.0 || ^10.0 || ^11.0
  • ๐Ÿ”„ CI/CD testing matrix expanded to include Laravel 13 on PHP 8.3
  • ๐Ÿ“ Updated documentation references to include Laravel 13
4.3.2

Fixed

  • ๐Ÿ› InlineCss Middleware: Fixed regex pattern to prevent matching framework-specific class attributes (Issues #75, #133, #154)
    • Changed from /class="(.*?)"/ to /(?<![-:])class="(.*?)"/i using negative lookbehind
    • Now correctly ignores ng-class (AngularJS), :class (Alpine.js), v-bind:class (Vue.js)
    • Horizon dashboard now works correctly with InlineCss (Issue #133)
    • AngularJS applications with ng-class work correctly (Issue #75)
    • Alpine.js :class shorthand works correctly (Issue #154)
    • Vue.js v-bind:class works correctly

Added

  • โœ… New test suite InlineCssJavaScriptFrameworksTest with 7 comprehensive tests (42 assertions)
  • โœ… Tests for AngularJS ng-class compatibility
  • โœ… Tests for Alpine.js :class shorthand compatibility
  • โœ… Tests for Vue.js v-bind:class compatibility
  • โœ… Tests for mixed framework scenarios
3.0.0

โš ๏ธ BREAKING CHANGES

  • PHP Requirements: Minimum PHP version increased to 8.2 (was 8.0)
  • Laravel Support: Removed support for Laravel 6.x, 7.x, 8.x, and 9.x
  • Dependencies: Updated minimum versions for all dependencies

Added

  • โœ… Laravel 12.x support
  • โœ… Laravel 11.x support
  • โœ… PHPUnit 11.x support
  • โœ… PHP 8.3 support
  • โœ… New tests for ServiceProvider (5 tests)
  • โœ… New tests for HtmlSpecs entity (4 tests)
  • โœ… GitHub Actions workflow for automated testing

Changed

  • ๐Ÿ“ฆ Updated Laravel support to ^10.0 || ^11.0 || ^12.0
  • ๐Ÿ“ฆ Updated PHP requirement to ^8.2 || ^8.3
  • ๐Ÿ“ฆ Updated PHPUnit to ^10.5 || ^11.0
  • ๐Ÿ“ฆ Updated Orchestra Testbench to ^8.0 || ^9.0 || ^10.0
  • ๐Ÿ“ฆ Updated Mockery to ^1.6
  • ๐Ÿงช Migrated all tests from [@test](https://github.com/test) annotation to test_* method naming convention
  • ๐Ÿงน Removed deprecated $defer property from ServiceProvider
  • โœจ Added void return types to ServiceProvider methods
  • ๐Ÿ“‹ Updated phpunit.xml.dist to PHPUnit 11.5 schema

Removed

  • โŒ Laravel 6.x, 7.x, 8.x, 9.x support (use v2.x for older Laravel versions)
  • โŒ PHP 8.0 and 8.1 support (use v2.x for PHP 8.0/8.1)
  • โŒ Deprecated $defer property from ServiceProvider

Testing

  • ๐ŸŽฏ Test coverage increased from 24 to 33 tests (37.5% increase)
  • โœ… All 33 tests passing with 125 assertions
  • ๐Ÿ”„ CI/CD testing across PHP 8.2/8.3 with Laravel 10/11/12/13

Migration Guide

From v2.x to v3.x

Requirements:

  • Update PHP to 8.2 or 8.3
  • Update Laravel to 10.x, 11.x, or 12.x

Steps:

  1. Update your composer.json:
{
    "require": {
        "php": "^8.2 || ^8.3",
        "laravel/framework": "^10.0 || ^11.0 || ^12.0",
        "vinkius-labs/laravel-page-speed": "^3.0"
    }
}
  1. Run composer update:
composer update vinkius-labs/laravel-page-speed
  1. Clear config cache:
php artisan config:clear
php artisan cache:clear

Breaking Changes:

  • If you're extending the ServiceProvider class, remove the $defer property
  • If you have custom middleware extending package middleware, ensure compatibility with Laravel 10+

Staying on v2.x:

If you need to stay on Laravel 6-9 or PHP 8.0/8.1, use version constraint:

{
    "require": {
        "vinkius-labs/laravel-page-speed": "^2.1"
    }
}

2.1.0

See previous releases for v2.x changelog.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui