Download the PHP package vlados/laravel-blade-crawler-detect without Composer
On this page you can find all versions of the php package vlados/laravel-blade-crawler-detect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vlados/laravel-blade-crawler-detect
More information about vlados/laravel-blade-crawler-detect
Files in vlados/laravel-blade-crawler-detect
Package laravel-blade-crawler-detect
Short Description Boost Lighthouse and PageSpeed scores by hiding cookie banners, chat widgets and heavy scripts from crawlers via two Blade directives. Octane-safe.
License MIT
Homepage https://github.com/vlados/laravel-blade-crawler-detect
Informations about the package laravel-blade-crawler-detect
Laravel Blade Crawler Detect
Two Blade directives that boost your Lighthouse and PageSpeed scores without changing a thing for real users.
Wrap your cookie banner, chat widget, analytics scripts, video embeds and other heavy chrome in @user ... @enduser. Bots like Googlebot, Lighthouse and PageSpeed will skip it entirely; humans see the same experience as before.
Result: lighter HTML for crawlers, better Core Web Vitals, more crawl budget spent on the content that actually matters — and zero JS or middleware changes.
Why developers reach for this
- Better Lighthouse / PageSpeed scores. Audit tools render the page like a low-power phone. Strip the widgets they don't need and the score climbs.
- Better Core Web Vitals. LCP, INP and CLS all benefit when crawlers stop pulling in chat libraries and consent banners.
- More crawl budget for real content. Googlebot fetches less JS, indexes more pages.
- One-line wrap. No middleware, no service container plumbing, no view composers — just Blade.
- Octane-safe. Reads the user agent per request, so long-running workers don't serve stale data.
- ReDoS-hardened. User-agent input is clamped before any regex runs.
- Up to date. Built on
jaybizzle/crawler-detect(thousands of bots, regularly updated) plus Lighthouse and PageSpeed out of the box.
Install
That's it — the service provider auto-registers. No config file, no migrations, no env vars.
Requires PHP 8.1+ and Laravel 10, 11, 12 or 13.
The two directives
@user — render only for humans
Anything that hurts your audit score, is invisible to bots anyway, or just doesn't need to ship to crawlers.
@unlessuser — render only for crawlers
Server-render the SEO-friendly equivalent of something you ship as JS to humans.
Real-world wins
Wrap this in @user |
Why it helps |
|---|---|
| Cookie consent banner | Removes ~200ms LCP delay on Lighthouse |
| Intercom / Drift / Zendesk widget | Removes 100-300KB of third-party JS |
| Google Tag Manager / Analytics | Removes blocking script + network round-trip |
| Optimizely / VWO / experimentation SDKs | Removes render-blocking script |
| Hotjar / FullStory / session recording | Removes 50-150KB of third-party JS |
| YouTube / Vimeo iframe embeds | Removes a heavy iframe + its JS |
| Mapbox / Google Maps iframes | Removes a heavy iframe + its tile fetches |
| Carousel / slider libraries | Removes JS + CSS that crawlers don't render |
| Chat triggers, modal openers | Removes interactive chrome bots can't click |
What "crawler" means
Detection is delegated to jaybizzle/crawler-detect, a battle-tested PHP library that ships a regex covering thousands of bots — Googlebot, Bingbot, DuckDuckBot, AhrefsBot, SemrushBot, Applebot, and so on.
This package additionally treats these as crawlers, since they typically run as audits rather than real visits:
Chrome-LighthouseGoogle Page Speed
Want to add your own? You can swap or wrap the CrawlerDetect instance through Laravel's container.
Performance
The crawler regex is compiled once per process (so Octane workers compile it at boot, traditional FPM workers compile it on first hit). Each render only does:
- One
substrto clamp the UA to 2KB. - One
preg_replacefor exclusions. - One
preg_matchagainst the compiled crawler pattern.
No DB queries, no cache lookups, no allocations beyond the strings above.
Octane / Swoole / RoadRunner
Safe by design. The user agent is read from the current request inside the directive's closure, so long-running workers always see the active request's UA — never a stale one cached at boot.
When NOT to use this
This package is a tool for hiding things crawlers don't need (heavy widgets, third-party scripts, modal chrome). It is not a tool for showing crawlers different content than you show users — that's cloaking under Google's spam policies and can earn a manual penalty. Use @unlessuser for SSR-equivalents of things you JS-render for humans, not for keyword stuffing.
Testing
Changelog
Please see CHANGELOG.
Contributing
Please see CONTRIBUTING.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Vladislav Stoitsov
jaybizzle/crawler-detect— the regex behind this package- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-blade-crawler-detect with dependencies
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
jaybizzle/crawler-detect Version ^1.2
spatie/laravel-package-tools Version ^1.14