donatj/phpuseragentparser
Lightweight PHP user-agent parser for detecting modern browsers and platforms from UA strings. Tiny codebase (<200 lines, 3 regexes), fast and accurate (including tricky IE versions). Composer-ready, 100% unit-tested, with optional object wrapper.
Feature Development:
Googlebot or Bingbot) or spam prevention (e.g., Slackbot, Twitterbot).Roadmap Prioritization:
Mobile Detect).Use Cases:
Platforms::IPHONE or Platforms::ANDROID.Googlebot) from analytics or personalization logic.curl, Wget) for further scrutiny in API requests.Platforms::JAPAN via Platforms::TIZEN or Platforms::ANDROID).Adopt When:
navigator.userAgent).Edge, Slackbot, ChatGPT-User) with minimal false positives.Look Elsewhere If:
user-agents (Node) or user_agents (Python).*"This is a low-risk, high-impact tool to supercharge our user experience and analytics without heavy lift. For less than 200 lines of code, we get:
Googlebot, Slackbot) to save server costs and protect APIs.*"This replaces custom UA parsing hacks with a battle-tested, regex-based solution that’s:
ChatGPT-User).parse_user_agent()) or OOP (UserAgentParser).composer.json and go.
Tradeoffs: Doesn’t handle OS versions (but that’s a known limitation; we’d use JS for that). Supports 99% of modern browsers/devices out of the box.
Proposal: Integrate this into our auth middleware for bot detection, and expose parsed UAs via a new UserAgent facade for analytics. Estimated effort: 1 day."*How can I help you explore Laravel packages today?