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
Phpbrowscap

Phpbrowscap Laravel Package

garetjax/phpbrowscap

PHP Browscap provides fast, accurate browser and user-agent detection for PHP applications. It parses browscap data to identify browser, platform, device, and crawler details, with caching support for production performance.

View on GitHub
Deep Wiki
Context7

Standalone replacement for php's native get_browser() function

Frequently asked questions about Phpbrowscap
What is garetjax/phpbrowscap and how does it differ from PHP's get_browser()?
garetjax/phpbrowscap is a standalone PHP library that parses browscap.ini data and returns structured browser, platform, device, and crawler metadata. It replaces PHP's native get_browser() without relying on the browscap ini directive being configured in PHP. It is framework-agnostic, so a Laravel application needs a thin adapter and service provider around it.
Is garetjax/phpbrowscap compatible with Laravel 8, 9, 10, and 11?
The package has no Laravel coupling, so Laravel compatibility depends mainly on whether its legacy-era code runs on your target PHP version. It has not been broadly validated on modern Laravel runtimes, so a short proof of concept is mandatory before committing. Keep it behind a BrowserDetector adapter so framework upgrades do not expose package internals.
How do I install garetjax/phpbrowscap with Composer in a Laravel app?
Install it with Composer using garetjax/phpbrowscap, then bind the package's browser class as a singleton in a service provider. Confirm the package's Composer constraints against your PHP runtime during the proof of concept. Application code should depend on your own BrowserDetector contract rather than importing the package namespace directly.
How do I configure the browscap.ini path and cache in Laravel?
Publish or copy the browscap ini file into storage/app/browscap, point your Laravel config at that path, and bridge the package cache to Laravel's cache store. Use Redis or another shared cache in production so workers do not each build a cold cache. Because the package's cache contract predates PSR-6 and PSR-16, you own the adapter glue.
Should I use the full browscap.ini or the lite version?
Start with the lite ini unless a specific product decision genuinely requires full capability data. The full ini is tens of megabytes and parsing it is CPU- and memory-heavy, so the choice changes memory and latency by an order of magnitude. Pair either option with a warm shared cache and a scheduled refresh process.
How do I cache browser detection results for performance?
Cache results per User-Agent string in a shared cache such as Redis, and warm that cache before traffic depends on it. Avoid parsing the ini on every request, because cold-cache parsing is the main performance risk. Schedule ini refreshes with an atomic file swap and a rollback path, and invalidate cached detections when the data changes.
Is garetjax/phpbrowscap still maintained, or should I use browscap/browscap-php?
This package has low ecosystem validation and signs of maintenance staleness, while browscap/browscap-php is the actively maintained successor with the same underlying data model. Treat garetjax/phpbrowscap as a reference implementation rather than a platform dependency. If you adopt it, put it behind an adapter so swapping to the successor stays contained.
Can I use garetjax/phpbrowscap for bot detection or security decisions?
No, User-Agent data is inherently spoofable and decays over time, so it must never gate security, access control, fraud checks, or other high-stakes behavior. Use it for conservative bot tagging, analytics enrichment, logging, legacy-browser messaging, or device-class routing. Keep security decisions on trusted server-side signals instead.
How does garetjax/phpbrowscap compare to jenssegers/agent or matomo/device-detector in Laravel?
jenssegers/agent and matomo/device-detector are alternatives that may already exist in your stack, so check for duplication before adding another User-Agent library. garetjax/phpbrowscap is framework-agnostic, legacy-era code with a maintained successor in browscap/browscap-php. Evaluate each consumer's accuracy threshold and keep the integration behind a BrowserDetector interface so alternatives remain swappable.
How should I migrate from get_browser() or an existing agent library in Laravel?
Introduce a BrowserDetector interface, implement it against this package, and run shadow mode against a sampled corpus of real User-Agent strings. Diff the output against your incumbent before promoting any consumer. Move logging and analytics first, then bot tagging, then any user-facing compatibility or feature gating, and roll back per consumer rather than per deployment.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo