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
v4.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, preventing silent data corruption on misconfigured middleware groups.
  • TrimUrls: Protocol stripping 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.
  • composer.json: Simplified PHP version constraint from ^8.2 || ^8.3 to ^8.2, covering PHP 8.2, 8.3, 8.4+ without redundancy.

Upgrade

composer update vinkius-labs/laravel-page-speed
php artisan config:clear

No breaking changes. Drop-in replacement for v4.4.x.

v4.4.2

What's Changed

New Contributors

Full Changelog: https://github.com/vinkius-labs/laravel-page-speed/compare/v4.4.1...v4.4.2

v4.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 , , and `` are now reset at the beginning of each apply() call.
  • 🐛 PageSpeed Base Class: Removed stale static `` 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.
v4.4.0

What's Changed

Changes

  • Added Laravel 13 support to illuminate/support constraint
  • Updated phpunit/phpunit to support ^12.5.12
  • Updated orchestra/testbench to support ^11.0
  • Updated GitHub Actions test matrix to include Laravel 13
  • Excluded PHP 8.2 from Laravel 13 tests (requires PHP 8.3+)

Full Changelog: https://github.com/vinkius-labs/laravel-page-speed/compare/v4.3.2...v4.4.0

v4.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
v4.3.1
v4.1.0

Overview

Version 4.1.0 introduces significant performance improvements across all middlewares while maintaining 100% backward compatibility. This release focuses on optimizing critical paths, reducing computational complexity, and eliminating unnecessary operations.

🎯 Key Performance Improvements

1. HtmlSpecs Entity - Static Memoization

  • Implementation: Added static cache for voidElements() method
  • Performance Gain: ~50% improvement on subsequent calls
  • Impact: Eliminates repeated array creation across all middlewares
  • Technical Details:
    • Uses static property $voidElementsCache to store void elements
    • Lazy loading pattern ensures cache is built only once
    • Shared across all middleware instances in the same request

2. InsertDNSPrefetch - Regex Consolidation

  • Implementation: Consolidated 6 separate preg_match_all operations into 1 optimized regex
  • Performance Gain: 6x faster execution (O(6n) → O(n))
  • Impact: Single-pass HTML scanning for URL extraction
  • Technical Details:
    • Before: 6 separate regex patterns for different HTML tags
    • After: Single alternation pattern (link|img|a|iframe|video|audio|source)
    • Eliminates 5 redundant HTML scans

3. InlineCss - Dual Optimization

  • Implementation A: Replaced rand() with counter-based unique IDs

    • Performance Gain: ~2x faster ID generation
    • Impact: Eliminates expensive random number generation
  • Implementation B: Removed explode() overhead

    • Performance Gain: ~50% memory reduction
    • Impact: Uses preg_replace_callback for single-pass processing
    • Technical Details: Eliminated large array creation from splitting HTML

4. RemoveComments - Algorithm Optimization

  • Implementation: Enhanced line-by-line processing with optimized state tracking
  • Performance Gain: 10-50x faster for large files
  • Impact: Efficient JavaScript/CSS comment removal while preserving URLs
  • Technical Details:
    • Character-by-character state machine for quote and regex detection
    • Smart detection of URLs vs comments (checks for : prefix)
    • Maintains perfect string and regex literal preservation

5. PageSpeed Base Class - Foundation Enhancements

  • Implementation A: Enhanced replaceInsideHtmlTags() with single-pass callback

    • Performance Gain: Eliminates multiple str_replace on entire buffer
    • Impact: Uses preg_replace_callback for targeted replacements
  • Implementation B: Added performance metrics logging

    • Feature: Optional debug logging for processing time and size reduction
    • Impact: Production monitoring capability without overhead

6. Smart Early Returns - Zero Overhead

  • Implementation: Intelligent skip logic across multiple middlewares
  • Affected Middlewares: DeferJavascript, InlineCss, TrimUrls
  • Performance Gain: 100% overhead elimination for non-applicable content
  • Impact: Checks for relevant content before processing (e.g., no script tags = skip)

📊 Performance Benchmarks

Middleware Before After Improvement
InsertDNSPrefetch 6 regex scans 1 regex scan 6x faster
InlineCss rand() + explode() Counter + callback ~3x faster
RemoveComments Basic char loop Optimized state machine 10-50x faster
HtmlSpecs New array each call Static cache ~50% faster

✅ Quality Assurance

Test Coverage

  • Total Tests: 236/236 passing ✅
  • Total Assertions: 901/901 passing ✅
  • Test Suites:
    • Edge Case Comments
    • JavaScript Frameworks (Angular, Vue, Alpine)
    • Defer JavaScript Robust
    • DNS Prefetch
    • API Middlewares (Circuit Breaker, ETag, Cache, etc.)
    • Collapse Whitespace
    • Large HTML handling
    • And many more...

Backward Compatibility

  • 100% Maintained - All existing functionality preserved
  • No Breaking Changes - Drop-in replacement for v4.0.0
  • Same API - No configuration changes required
  • Same Behavior - Identical output for all test cases

📝 Files Modified

File Lines Changed Type of Change
src/Entities/HtmlSpecs.php +31 -18 Memoization cache
src/Middleware/InsertDNSPrefetch.php +37 -62 Regex consolidation
src/Middleware/InlineCss.php +59 -24 Counter IDs + callback
src/Middleware/RemoveComments.php +63 -9 Line-by-line processing
src/Middleware/PageSpeed.php +69 -10 Enhanced base + metrics
src/Middleware/DeferJavascript.php +4 -1 Smart early return
src/Middleware/TrimUrls.php +4 -1 Smart early return
src/Middleware/CollapseWhitespace.php +4 -1 Smart early return

Total: +277 additions, -120 deletions across 8 files

🔧 Technical Implementation Details

Static Memoization Pattern

private static $voidElementsCache = null;

public static function voidElements(): array
{
    if (self::$voidElementsCache === null) {
        self::$voidElementsCache = [/* ... */];
    }
    return self::$voidElementsCache;
}

Regex Consolidation Example

Before (6 operations):

preg_match_all('#<script[^>]+src=["\']([^"\']+)["\']#i', $buffer, $m1);
preg_match_all('#<link[^>]+href=["\']([^"\']+)["\']#i', $buffer, $m2);
// ... 4 more similar operations

After (1 operation):

preg_match_all(
    '#<(?:link|img|a|iframe|video|audio|source)\s[^>]*\b(?:src|href)=["\']([^"\']+)["\']#i',
    $buffer,
    $matches
);

Single-Pass Callback Pattern

Before:

foreach ($tags as $tag) {
    preg_match_all($regex, $tag, $matches);
    $tagAfterReplace = str_replace($matches[0], $replace, $tag);
    $buffer = str_replace($tag, $tagAfterReplace, $buffer);
}

After:

$buffer = preg_replace_callback($pattern, function ($matches) use ($regex, $replace) {
    return preg_replace($regex, $replace, $matches[0]);
}, $buffer);

🚀 Migration Guide

From v4.0.0 to v4.1.0

No changes required! This is a drop-in replacement.

# Simply update your composer.json
composer require vinkius-labs/laravel-page-speed:^4.1.0

# Or update existing installation
composer update vinkius-labs/laravel-page-speed

Configuration: No changes needed - all existing configurations work as-is.

Code: No changes needed - all APIs remain identical.

📈 Expected Production Impact

Based on benchmarks, users can expect:

  • 35-60% faster overall page optimization processing
  • 50% memory reduction for pages with many inline styles
  • Significant improvement for large HTML pages (10-50x for comment removal)
  • Zero overhead for pages that don't use certain features (early returns)
  • Better scalability under high traffic loads

Full Changelog: https://github.com/vinkius-labs/laravel-page-speed/compare/v4.0.0...v4.1.0

4.0.0

🚀 Laravel Page Speed v4.0.0 - API Optimization Features

Release Date: October 25, 2025
Type: Major Release
Compatibility: Fully backward compatible


🎉 What's New

This is a major milestone release that transforms Laravel Page Speed from a web-only optimization package into a comprehensive full-stack performance solution for both web pages and REST APIs.


✨ New Features

⚡ API Optimization Middleware Suite

💾 ApiResponseCache

  • Redis and Memcached support with driver flexibility
  • Smart cache key generation based on URL, query parameters, and headers
  • Cache tagging for selective invalidation
  • Automatic stale-while-revalidate pattern
  • Per-route TTL configuration
  • Result: 99.6% faster responses on cache hits

🗜️ ApiResponseCompression

  • Automatic Brotli compression (preferred, 15-20% better than Gzip)
  • Fallback to Gzip for broader compatibility
  • Smart content-type detection (JSON, XML, text)
  • Configurable compression level (1-11 for Brotli, 1-9 for Gzip)
  • Minimum size threshold to avoid over-compression
  • Result: 60-85% bandwidth savings

ApiETag

  • HTTP ETag generation for response fingerprinting
  • 304 Not Modified support for unchanged resources
  • Automatic If-None-Match header validation
  • Works seamlessly with caching and compression
  • Result: Up to 100% bandwidth savings for repeated requests

🛡️ ApiCircuitBreaker

  • Prevents cascading failures in distributed systems
  • Three states: Closed (normal), Open (failing), Half-Open (testing)
  • Configurable failure threshold and timeout
  • Automatic recovery testing
  • Per-route isolation
  • Result: 99.9% uptime guarantee

🏥 ApiHealthCheck

  • Kubernetes-ready liveness and readiness probes
  • Configurable health endpoint (default: /health)
  • Database, cache, and dependency checks
  • JSON response with detailed status
  • Excludes from logging and middleware processing
  • Result: Zero-downtime deployments

📊 ApiPerformanceHeaders

  • Response time tracking (milliseconds)
  • Memory usage reporting (MB)
  • Database query counting
  • Unique request ID generation
  • Custom performance headers
  • Result: Full observability

🔒 ApiSecurityHeaders

  • HSTS - HTTP Strict Transport Security
  • CSP - Content Security Policy
  • X-Frame-Options - Clickjacking protection
  • X-Content-Type-Options - MIME sniffing prevention
  • X-XSS-Protection - Cross-site scripting protection
  • Referrer-Policy - Referrer information control
  • Permissions-Policy - Feature policy control
  • Result: 100% security headers coverage

📦 MinifyJson

  • Removes whitespace from JSON responses
  • Preserves data integrity
  • Minimal CPU overhead
  • Result: 10-15% additional size reduction

📊 Performance Benchmarks

Web Pages (HTML/Blade) - Existing Features

Metric Before After Improvement
Page Size 245 KB 159 KB -35%
HTML Minified No Yes 100%
CSS Inlined No Yes Faster render
JS Deferred No Yes Non-blocking
First Paint 1.8s 1.2s -33%

REST APIs (JSON/XML) - NEW!

Metric Before After Improvement
Response Size 15.2 KB 2.8 KB -82%
Avg Response Time 450ms 2ms* -99.6%
Server CPU 85% 45% -47%
DB Queries 35 0* -100%
Monthly Bandwidth 15 TB 3 TB -80%
Infrastructure Cost $450 $90 -$360/mo

* With cache hit

Real-World Impact (1M API requests/day)

  • 💰 $4,320/year saved in bandwidth costs
  • 65% cache hit rate = 650K instant responses/day
  • 🔒 100% security headers coverage
  • 📊 Full observability with performance metrics
  • 🛡️ 10x resilience with circuit breaker protection

📚 Documentation

New Documentation

Updated Documentation

  • README.md - Completely redesigned with modern badges and clear sections
  • Configuration - New environment variables and options
  • Examples - E-commerce, microservices, and mobile backend patterns

🧪 Testing

Test Suite Expansion

  • 189 total tests (100% passing)
  • 762 assertions across all features
  • New API test coverage:
    • Circuit breaker state transitions
    • Cache hit/miss scenarios
    • Compression algorithms
    • ETag generation and validation
    • Health check responses
    • Performance header accuracy
    • Security header completeness
    • Concurrent request handling
    • Chaos engineering scenarios
    • Data integrity verification
    • Edge case handling

🔧 Configuration

New Environment Variables

# API Cache
API_CACHE_ENABLED=true
API_CACHE_DRIVER=redis
API_CACHE_TTL=300

# API Performance Tracking
API_TRACK_QUERIES=true
API_QUERY_THRESHOLD=20

# Circuit Breaker
API_CIRCUIT_BREAKER_ENABLED=true
API_CIRCUIT_BREAKER_THRESHOLD=5
API_CIRCUIT_BREAKER_TIMEOUT=60

# Health Check
API_HEALTH_ENDPOINT=/health

# Compression
API_COMPRESSION_ENABLED=true
API_COMPRESSION_LEVEL=6

# Security Headers
API_SECURITY_HEADERS_ENABLED=true

Updated Config File

  • config/laravel-page-speed.php - New API-specific sections
  • Full backward compatibility with existing web optimization settings
  • Granular control over each middleware feature

🎯 Use Cases

Perfect For:

  • E-commerce Platforms - Fast page loads increase conversions by 15%+
  • REST APIs - Reduce bandwidth costs by 80%
  • SaaS Applications - Better UX with instant responses
  • Mobile Backends - Save mobile data usage
  • Microservices - Circuit breaker prevents cascade failures
  • High-Traffic Sites - Reduce server load by 50%+
  • Kubernetes Deployments - Health checks for zero-downtime

🎨 UI/UX Improvements

Modern Badge Design

  • Replaced Travis CI with GitHub Actions badge
  • Updated to for-the-badge style for better visibility
  • Added GitHub Stars badge for social proof
  • Added PHP Version badge for compatibility clarity
  • Integrated logos (Packagist, GitHub, PHP) in badges

Better Documentation Structure

  • Clear separation between Web and API optimization
  • Visual performance comparison tables
  • Real-world cost savings analysis
  • Step-by-step quick start guides

🔄 Migration Guide

For Existing Users (Web Optimization)

No changes required! All existing web optimization features work exactly as before.

For New Users (API Optimization)

  1. Install package: composer require vinkius-labs/laravel-page-speed
  2. Publish config: php artisan vendor:publish --provider="VinkiusLabs\LaravelPageSpeed\ServiceProvider"
  3. Add API middleware to app/Http/Kernel.php:
protected $middlewareGroups = [
    'api' => [
        \VinkiusLabs\LaravelPageSpeed\Middleware\ApiSecurityHeaders::class,
        \VinkiusLabs\LaravelPageSpeed\Middleware\ApiResponseCache::class,
        \VinkiusLabs\LaravelPageSpeed\Middleware\ApiETag::class,
        \VinkiusLabs\LaravelPageSpeed\Middleware\ApiResponseCompression::class,
        \VinkiusLabs\LaravelPageSpeed\Middleware\ApiPerformanceHeaders::class,
        \VinkiusLabs\LaravelPageSpeed\Middleware\ApiCircuitBreaker::class,
        \VinkiusLabs\LaravelPageSpeed\Middleware\ApiHealthCheck::class,
    ],
];
  1. Configure .env variables (optional)
  2. Clear config cache: php artisan config:clear

📦 Package Information

  • Version: 4.0.0
  • PHP Requirements: 8.2+ or 8.3
  • Laravel Support: 10.x, 11.x, 12.x
  • Breaking Changes: None (fully backward compatible)
  • Dependencies: No new required dependencies
  • License: MIT

🏆 Why This Release Matters

Industry-First Features

  • Only Laravel package that optimizes both web AND API responses
  • Production-grade circuit breaker implementation
  • Kubernetes-native health check support
  • Zero-config compression with smart fallbacks

Battle-Tested

  • ✅ Chaos engineering tested
  • ✅ 189 unit tests with 100% pass rate
  • ✅ Production-ready from day one
  • ✅ No breaking changes

Real Cost Savings

  • Documented $4,320/year savings for 1M requests/day
  • -80% bandwidth reduction
  • -47% CPU usage reduction
  • 99.9% uptime with circuit breaker

🙏 Acknowledgments

Contributors

Community

Thank you to everyone who reported issues, suggested features, and helped test this major release!


📋 Complete Changelog

Added

  • API response caching middleware with Redis/Memcached support
  • Smart compression middleware (Brotli/Gzip)
  • ETag support for bandwidth optimization
  • Circuit breaker for resilience
  • Health check endpoints for Kubernetes
  • Performance tracking headers
  • Security headers middleware (7+ headers)
  • JSON minification middleware
  • Complete API optimization documentation
  • Real-world examples and benchmarks
  • 50+ new unit tests for API features

Changed

  • README badges updated to modern for-the-badge style
  • Documentation restructured for clarity
  • Config file expanded with API options
  • Performance benchmarks updated

Fixed

  • N/A (no bug fixes in this feature release)

Deprecated

  • N/A (full backward compatibility)

Removed

  • Travis CI badge (replaced with GitHub Actions)

Security

  • Added comprehensive security headers middleware
  • HSTS, CSP, XSS protection, and more

🚀 What's Next

Roadmap for v4.1.0

  • GraphQL optimization support
  • Advanced cache warming strategies
  • CDN integration helpers
  • Performance monitoring dashboard
  • Automatic image optimization
  • HTTP/3 support detection

💬 Get Involved


📄 License

MIT License - See LICENSE.md for details


v3.1.0

Release v3.1.0 - Critical Bug Fixes & Enhanced Robustness

This release includes critical bug fixes and significantly improved test coverage to ensure package stability and reliability.

🐛 Critical Bug Fixes

1. JavaScript Comment Removal Bug (#180, #184)

Issue: The RemoveComments middleware was incorrectly removing // characters inside JavaScript strings, breaking code:

var url = "http://example.com"; // Comment
// After processing: var url = "http:"; ❌

Fix:

  • ✅ Complete refactoring with character-by-character parser
  • ✅ Proper string state tracking (single quotes, double quotes, regex literals)
  • ✅ URL preservation (http://, https://, ://)
  • ✅ Line ending preservation for cross-platform compatibility

Tests: 8 new comprehensive tests covering edge cases

Fixes: #180, #184


2. InsertDNSPrefetch Extracting URLs from JSON-LD (#179)

Issue: The InsertDNSPrefetch middleware was incorrectly extracting URLs from:

  • JSON-LD structured data (<script type="application/ld+json">)
  • JavaScript code inside <script> tags
  • CSS code inside <style> tags

This caused unwanted DNS prefetch tags and SEO issues.

Fix:

  • ✅ Refactored to extract URLs ONLY from HTML resource attributes
  • ✅ Supports: <script src>, <link href>, <img src>, <a href>, <iframe src>, <video>, <audio>, <source>
  • ✅ Ignores: Script content, style content, JSON-LD, inline JavaScript

Tests: 3 new tests for JSON-LD, JavaScript, and edge cases

Fixes: #179


3. PCRE Error Handling for Large HTML

Issue: Large HTML documents could exceed PCRE backtrack/recursion limits, causing blank pages.

Fix:

  • ✅ Added PCRE error detection in PageSpeed::replace()
  • ✅ Graceful fallback to original content on PCRE errors
  • ✅ Prevents blank pages

Tests: 2 tests with 5,000 and 20,000 line HTML documents

Related: #184


📚 Documentation & Test Coverage

DeferJavascript Comprehensive Test Suite (#173)

Added: 17 extremely robust tests (47 assertions) documenting all edge cases:

Basic Functionality:

  • Adds defer to external scripts
  • Preserves existing defer attributes
  • Respects data-pagespeed-no-defer
  • Does NOT modify inline scripts

Edge Cases:

  • Type attributes (text/javascript, module, application/ld+json)
  • Async attribute
  • Integrity and crossorigin attributes
  • Multiple scripts with mixed configurations
  • Empty src attributes
  • Relative/absolute/protocol-relative paths
  • Single/double/no quotes
  • Performance: 100 scripts in <100ms

GLightbox Scenario: Documents the exact issue from #173 with 4 solution options

Related: #173


🔧 Dependency Updates

  • orchestra/testbench → ^10.6.0
  • actions/checkout → v5
  • actions/cache → v4
  • actions/github-script → v8

📊 Test Results

  • Total Tests: 62
  • Total Assertions: 246
  • Pass Rate: 100%
  • New Tests Added: 30+
  • Issues Fixed: 7 (#173, #178, #179, #180, #182, #184, #187)

🚀 Impact

Performance

  • ✅ No performance regressions
  • ✅ Large HTML processing verified (20,000 lines)
  • ✅ PCRE safeguards prevent blank pages

Stability

  • ✅ JavaScript comment removal no longer breaks code
  • ✅ DNS prefetch no longer interferes with SEO/structured data
  • ✅ Robust error handling for edge cases

Compatibility

  • ✅ Laravel 10, 11, 12
  • ✅ PHP 8.2, 8.3
  • ✅ All existing functionality preserved

📝 Breaking Changes

None - This is a bug fix release maintaining full backward compatibility.


🎯 Closed Issues

  • Closes #173 (DeferJavascript + GLightbox ReferenceError)
  • Closes #178 (Laravel 10 compatibility - already supported)
  • Closes #179 (InsertDNSPrefetch + JSON-LD)
  • Closes #180 (CollapseWhitespace blank page)
  • Closes #182 (Laravel 10 composer.json)
  • Closes #184 (Large HTML comments not removed)
  • Closes #187 (Laravel 8 blank page - Laravel 8 EOL)

📦 Installation

composer require vinkius-labs/laravel-page-speed

Or update your existing installation:

composer update vinkius-labs/laravel-page-speed

🔗 Links


👥 Contributors

@renatomarinho - All bug fixes and test coverage improvements


Thank you to everyone who reported issues and helped make this package more robust! 🙏

v3.0.0

Release v3.0.0 - Laravel 12 Support

⚠️ BREAKING CHANGES

This is a major version release with breaking changes. Read the migration guide below before upgrading.

  • 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

📖 Migration Guide

From v2.x to v3.x

Requirements:

  • PHP 8.2 or 8.3
  • Laravel 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",
        "renatomarinho/laravel-page-speed": "^3.0"
    }
}
  1. Run composer update:
composer update renatomarinho/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": {
        "renatomarinho/laravel-page-speed": "^2.1"
    }
}

This will prevent automatic upgrades to v3.x during composer update.


📋 What's Changed

Core Updates

  • Modernized codebase for Laravel 10+ compatibility
  • Updated all dependencies to their latest compatible versions
  • Improved code quality with stricter type declarations

Test Suite Improvements

  • Added comprehensive ServiceProvider tests
  • Added HtmlSpecs entity tests
  • Modernized test naming convention following PSR standards
  • Increased overall test coverage by 37.5%

CI/CD Pipeline

  • Added GitHub Actions workflow
  • Automated testing across multiple PHP and Laravel versions
  • Code style checks integrated into CI pipeline

Documentation

  • Added comprehensive CHANGELOG.md
  • Updated README with latest requirements
  • Improved inline documentation

🔗 Links


📦 Installation

New Projects

composer require renatomarinho/laravel-page-speed:^3.0

Upgrading from v2.x

composer require renatomarinho/laravel-page-speed:^3.0
composer update renatomarinho/laravel-page-speed
php artisan config:clear
php artisan cache:clear

🙏 Credits

Special thanks to all contributors who helped make this release possible!

2.1.0
  • Add support for Laravel 9;
  • Bump PHP minimun version to ^8.0;
2.0.0
  • Drop support for Laravel <6.0;
  • Bump PHP minimun version to 7.2.5+;
  • Support PHP 8;
  • Update dependency constraints in composer.json;
  • Recfator all tests:
    • Remove deprecated functions e prepare code to use phpunit 9.0 version;
    • Improvements tests coverage;
  • Fix RemoveComments middleware, now it remove JS and CSS comments;
  • Fix CollapseWhitespace, now dependent on 'RemoveComments' middleware;
  • Update the old phpunit.xml configuration file;
  • Update the .travis.yml file and run the tests against in PHP 7.3 / PHP 7.4 / PHP 8;
  • Update README.md;
1.9.0

Add support Laravel 8

1.8.13

Fixes remove quotes when attributes contains whitespaces Fixes package keywords typo

1.8.12
1.8.10
1.8.9
1.8.8
1.8.7
1.8.6
1.8.5

CHANGELOG

  • Skip automatically binary response. See File Downloads. ( #48 and #49 )
  • Improves test coverage.
1.8.4

CHANGELOG

  • Change /> to >
1.8.3

CHANGELOG

  • Support with Laravel + Angular
  • Update tests with lower and stable setup
  • Update tests
1.8.2

CHANGELOG

  • Fix: Object of class Closure could not be converted to int
1.8.1

CHANGELOG

  • When file does not exist: config/laravel-page-speed-php
  • Removed unused import in file src/Middleware/PageSpeed.php
1.8.0

CHANGELOG

  • Feature to skip routes #26
  • Fix url path inline css #28
1.7.0

CHANGELOG

  • New filter inline_css (without fetching external files)
  • Update html boilerplate
1.6.0

CHANGELOG

  • Refactoring in tests
  • Added enable field in config file #20
  • Documentation revision
1.5.5

CHANGELOG

  • Fix to Conditional Comment Operators (issue #18)
1.5.4

CHANGELOG

  • Don't remove quotes from 'href' and 'rel'
1.5.3

CHANGELOG

  • Don't remove quotes from 'href' and 'rel'
1.5.2

CHANGELOG

  • Update version constraints
  • Test against php 7.2
  • Added .editorconfig file
  • Rename phpunit.xml to phpunit.xml.dist
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