angus-mcritchie/blade-boost-directive
Adds a simple @boost Blade directive to Laravel apps, enabling browser prefetching and prerendering of linked pages so navigation feels instant. Configure which links to boost and improve perceived performance with minimal code changes.
Architecture fit
@boost / @endboost) registered as a Composer-installed Laravel library. There is no service-provider surface, no config file, no migrations, and no runtime middleware — it is a compile-time template hook. That makes its architectural footprint near-zero and its removal cost near-zero, which is the most important thing a TPM can say about it.@production / env('APP_ENV') guards that teams already hand-roll. That places it in the "non-differentiating utility" bucket: correct default is to avoid owning custom code for it, provided the dependency is cheap and trustworthy.Integration feasibility
composer require, restart, wrap a section. No configuration, no publish step, no migration. A developer can validate the whole thing in an afternoon.app()->environment('local') or APP_ENV, then the correctness of every boosted section in staging and production depends on a single string in a .env file that platform teams routinely template, copy, and occasionally mis-set.Technical risk
APP_ENV is local in any deployed environment — a copied .env, a misconfigured container, a preview environment that reuses the local template — the boosted sections vanish with no exception, no log line, and no error page. The result is a page that renders successfully with content missing. This is a P1-class failure mode with near-zero detectability from application logs; it must be caught by assertion tests or post-deploy smoke checks, not monitoring.@push directives for scripts or styles, those pushes will not occur locally but will in production. Layout-level asset bundles can therefore differ between environments in ways nobody is looking at.Key questions
@boost decide at compile time or runtime, and does flipping APP_ENV require a view:clear / recompile of cached views? This determines our deploy runbook.app()->environment('local'), an explicit config key, or a list of environments? Can we override it per-environment (e.g. enable in staging but not local)?@push, @once, @section, and component slots inside a boosted block handled predictably?Stack fit
Build vs. buy vs. inline (the actual decision)
Three viable paths, in ascending order of control:
AppServiceProvider. Roughly a dozen lines using Blade::directive(). Cost: we own it; benefit: we own the predicate, the escape hatch, the logging, and the ability to make it fail loudly.@unless(app()->isLocal()) at call sites. No dependency at all, but reintroduces the scattered-conditionals problem the package exists to solve.A TPM recommendation: adopt path 1 for speed, but wrap it behind a project-owned directive alias (e.g. our own @expensiveSection that delegates to @boost) so path 2 is a one-file swap and call sites never change. That converts an external dependency into an implementation detail for the cost of a few lines — the correct trade for a low-star utility on a hot path.
Migration path
@production, env() and app()->isLocal() guards in Blade views — this is the true scope and it is measurable before any code is written.Compatibility
Sequencing
Maintenance
composer.lock, review on a regular cadence, and do not accept uncontrolled minor bumps into Blade-layer dependencies.Support
Scaling
view:cache. If suppression is resolved at compile time, cached views in a container image could bake in the wrong environment's output. That is a deploy-pipeline concern, not a throughput concern, and it is the single most likely way this package causes a production incident.Failure modes
| Failure | Detection | Mitigation |
|---|---|---|
APP_ENV=local in a deployed environment suppresses content silently |
Only via content assertions or smoke tests | Assert boosted regions render in post-deploy checks; alert on missing markers |
| Stale compiled views bake in the wrong branch | Deploy-time diff or content assertion | view:clear / rebuild views in the image build, not at runtime |
| Local bugs in boosted regions go unnoticed | QA report / "cannot reproduce" | Document the force-render escape hatch; include boosted regions in CI browser tests |
Asset stack divergence from @push inside boosted blocks |
Visual regression in staging | Avoid @push inside boosted blocks; keep them content-only |
| Composer conflict on a future Laravel major | composer update in CI |
Required CI job that resolves against the next major early |
| Upstream abandonment | Package staleness | Pre-wrapped behind project-owned alias; swap to inline in one file |
Ramp-up
How can I help you explore Laravel packages today?