Weave 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

Laravel Page Speed is an end-to-end optimization pipeline for Blade-rendered pages and REST APIs, with composable middleware, measurable latency and bandwidth gains, store-agnostic caching, and built-in observability and resilience for Laravel 10–13.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is a middleware-based response-transformation layer that sits at the edge of the Laravel HTTP lifecycle, between controller output and the client. It does not touch routing, models, or business logic, which is the lowest-blast-radius integration pattern available in Laravel. The composable middleware model (enable only what you need via config/laravel-page-speed.php) is the right design for a TPM: it makes adoption incremental and reversible per optimization rather than a single all-or-nothing switch. Dual scope (Blade HTML + JSON/XML APIs) means one dependency can serve both the web and API squads, which reduces procurement and review overhead but also concentrates risk in a single package.

Integration feasibility. Very high. composer require plus middleware registration in app/Http/Kernel.php (Laravel 10) or bootstrap/app.php (Laravel 11–13), then vendor:publish for config. Both registration patterns are documented explicitly, and the version matrix (Laravel 10–13, PHP ^8.2) covers current and next-cycle stacks. Realistic effort is 1–2 engineer-days for a working spike and 1–2 sprints for a production rollout including QA. The presence of docs, changelog, releases, and a Discord channel suggests the support surface exists even if informal.

Technical risk. The dominant risk class is regex-based HTML rewriting, and the changelog is effectively a catalogue of that risk materializing: PCRE stack exhaustion producing blank pages (fixed 4.4.2), Livewire/Alpine attributes corrupted during whitespace collapsing (fixed 4.4.2), TrimUrls corrupting JS strings, meta tags, and SVG namespaces (fixed 4.4.3), and state leaks across requests under Octane/Swoole (fixed 4.4.1). Each has been remediated, and the maintainers added a Content-Type guard that prevents web middleware from touching JSON/XML — a genuinely important safety fix. But the pattern tells us this package has been hardened by production incidents, not by design review, and we should assume more edge cases exist. Secondary risks: middleware that emits security headers (HSTS, CSP, Permissions-Policy) creates an ownership ambiguity with the app, the CDN, and the WAF — misconfiguration here breaks third-party scripts in ways that are hard to attribute. Tertiary: response caching introduces invalidation-correctness risk, and the circuit breaker introduces a new failure mode of its own (false tripping).

Key questions.

  1. Provenance. Dependents = 0 while stars = 2508, and the README's Packagist download badge points at renatomarinho/laravel-page-speed. This strongly implies vinkius-labs is a fork or successor of a well-known package. We need to confirm: is the star count inherited, transferred, or organic? Who is the legal maintainer of record? Is there a documented migration path from upstream, and does the upstream receive security fixes this fork inherits?
  2. Bus factor. Release cadence is fast and detailed, but the project reads as one or two maintainers. What is the continuity plan if it stalls? (MIT + simple middleware means we can vendor-fork, which is the mitigation.)
  3. Security header ownership. If we enable ApiSecurityHeaders, does the package own CSP/HSTS, or does our edge? A silent X-XSS-Protection: 0 change (4.4.3) is a good default but a decision we should own explicitly.
  4. Cache scope. Is ApiResponseCache intended for authenticated endpoints? The method-aware invalidation and dynamic tag derivation need a documented guarantee that user-scoped responses cannot collide. This is the single highest-severity unknown.
  5. Benchmark validity. The "Measured Impact" table (99.6% latency reduction, 100% query elimination) is a cache-hit microbenchmark against a 1M req/day, 65%-hit-rate reference scenario. We must reproduce with our own traffic shape before quoting numbers to stakeholders.
  6. Store-agnostic claim. Cache tags are not natively supported by file, array, or database drivers in Laravel. The README asserts support across all listed drivers — we need to verify tag behavior on our actual production driver before designing invalidation around it.

Integration Approach

Stack fit. Strong for a standard Laravel 10–13 monolith or modular monolith. Works with Redis, Memcached, DynamoDB, file, and array cache drivers — but our production driver should drive the scope of what we enable. If we run Redis with cluster mode, validate tag derivation behavior under key hashing before committing to the caching middleware. If we already terminate TLS at a CDN or ALB that does Brotli/Gzip and HTTP caching, the compression and cache middleware duplicate edge capability and add CPU cost inside PHP for marginal benefit; in that topology we should consider adopting only the low-risk web minification plus observability headers. The circuit breaker and health check middleware overlap with Kubernetes probes, service mesh retries, and existing APM — adopt only if we have a gap.

Migration path. Do not do a big-bang adoption. Sequence a shadow pilot first: install on a throwaway Laravel 11 and Laravel 12 app, exercise the web pipeline against realistic Blade templates (Bootstrap, Tailwind, Livewire, Alpine, inline <script type="application/ld+json">) and the API pipeline against representative JSON, XML, streaming, and file-download responses. Then pilot in production behind LARAVEL_PAGE_SPEED_ENABLE, starting with the middleware that changes nothing semantically.

Compatibility and ordering. Middleware order is the deliverable, not an afterthought. For the API group, compression must wrap (not be wrapped by) cache so cached payloads are already encoded or encoded per-negotiation; ApiETag must respect pre-existing Cache-Control (the 4.4.3 fix does this, but our own middleware may still conflict); ApiPerformanceHeaders must run outermost to measure the full stack. For the web group, CollapseWhitespace and RemoveComments must run after anything that injects markup and before DeferJavascript. Confirm the app's existing middleware — Debugbar, Telescope, Horizon are skipped by default, which is good, but any custom diagnostics or HTML-rewriting middleware must be reconciled. Verify Octane/Swoole compatibility explicitly given the 4.4.1 state-leak history.

Sequencing.

  • Week 1 — Evaluation. Spike repo, publish config, baseline metrics captured (p95/p99 latency, egress, payload sizes, CPU per request) on a canary route.
  • Week 2 — Observability first. Enable only ApiPerformanceHeaders and ApiHealthCheck in staging. Zero semantic change, immediate instrumentation, validates the header contract with our APM ingestion.
  • Weeks 3–4 — Web pilot. CollapseWhitespace, RemoveComments, ElideAttributes behind a flag on a low-traffic marketing surface. Visual regression suite plus a Livewire/Alpine interaction smoke test are mandatory gates, not optional.
  • Weeks 5–6 — API compression and ETag. ApiResponseCompression, ApiETag, ApiSecurityHeaders on unauthenticated read-only endpoints. Measure CPU headroom — Brotli is materially more expensive than Gzip at scale.
  • Weeks 7–8 — Cache and circuit breaker. ApiResponseCache and ApiCircuitBreaker last, only on idempotent GETs with an explicit tag and invalidation strategy written down, and only after a load test that includes deploy-time invalidation.
  • Week 9+ — Expand and formalize. Roll to remaining groups, pin the version, add a dependency-review gate so each 4.4.x bump is read, not auto-merged.

Operational Impact

Maintenance. MIT license, small maintainer team, fast release cadence, and a detailed changelog — the latter is the most operationally valuable artifact here because it tells us exactly what kinds of defects to test for on upgrade. The cost is churn: 4.4.1 through 4.4.4 all contain correctness fixes, not just cosmetic ones. Pin exact versions in composer.json, review every diff, and never auto-merge. Budget roughly 1 engineer-day per release cycle to read the changelog, run the regression suite, and decide on adoption.

Support. Community-only — GitHub Issues, Discussions, Discord. No SLA, no indemnification, no security disclosure policy we can point to. Mitigation: record it in the vendor risk register, nominate an internal owner, and confirm that a fork is viable (it is: MIT, middleware-only, no native extensions). If this becomes load-bearing for revenue paths, we should have an internal branch ready to go within a sprint.

Scaling. Three cost surfaces. (1) CPU per request for HTML minification on dynamic pages — this scales linearly with traffic and does not benefit from caching; cap it by only enabling the rewrite middlewares where the rendered output is itself cached or where egress is the binding constraint. (2) CPU and memory for Brotli — measure under sustained load, not a single request. (3) The cache backend becomes a hard dependency with its own capacity, eviction, and hot-key profile; tag cardinality can explode if dynamic tag derivation produces per-request tags, and cache-tag explosion is a common production failure. Size Redis and set eviction policy before enabling, not after.

Failure modes to instrument and rehearse.

  • Silent page breakage from a regex failure. The 4.4.2 fallback-to-original-content should prevent it, but the symptom is a blank page for a subset of users — add a canary check that asserts content-length and a content hash on a synthetic page.
  • Cache poisoning across users if a personalized endpoint is cached. This is a security incident, not a performance bug. Enforce an allowlist of cacheable routes rather than a denylist.
  • Stale content after deploys if invalidation tags change shape between releases. Test deploy-time invalidation in CI.
  • Circuit breaker false positives masking or amplifying an outage. Tune thresholds against load-test data, alert on state transitions, and never let the breaker be the only thing standing between users and a dependency.
  • CSP violations from package-emitted security headers colliding with edge policy. Reconcile in staging with a report-only CSP first.
  • Health check probe caching (10s window) delaying Kubernetes readiness reaction to a fast-recovering dependency.
  • Persistent-worker state leaks under Octane after future upgrades — regression-test the 4.4.1 fixes explicitly.

Ramp-up. Low to moderate. Any Laravel engineer can wire this up in an afternoon; the real learning curve is in the areas the package assumes you already understand: HTTP caching semantics (ETag, Vary, Cache-Control), middleware ordering, and CSP. Allocate one engineer as owner, two engineer-days of training on the config reference and cache architecture docs, and a written runbook covering rollback (flip LARAVEL_PAGE_SPEED_ENABLE), cache flush, and per-middleware disable. Expect meaningful value in the first month from compression and observability alone; treat the caching layer as a second, separately justified phase. The 0-dependents signal means we are among the earliest production adopters at scale — price that into the pilot duration rather than assuming ecosystem battle-testing we do not have.

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.
thuraaung2493/laravel-rulecraft
cyberwizard/schedule-catchup
livetennisapi/livetennisapi-laravel
roundly-consulting/notifications-for-laravel
flightsadmin/bootstrap-starter-kit
lasserafn/laravel-intempus
likyly/sdk
tdt/input
coreation/php-shapefile
coreation/gisconverter
primix/widgets
primix/notifications
primix/actions
primix/tables
primix/details
primix/forms
primix/support
marcelgwerder/laravel-api-handler
firebrikdotcom/conveyor-laravel-broadcaster
kanata-php/conveyor-laravel-broadcaster