Laravel User Agent Rust
Browser, platform, device and robot detection from the user agent, as a handler argument.
cargo add laravel-user-agent-rust
Try it
This is what the crate reads from the request your browser just sent. Open the page on your phone and it changes.
Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
- Device type
- robot
- Browser
- none
- Platform
- none
- Device
- none
- Robot
- ClaudeBot
- Mobile, tablet, phone, desktop
- no, no, no, no
- Languages
- none
This site uses it to log which robots visit and whether they asked for markdown. The demo above shows what it reads from the request your browser just sent.
What it does
-
A handler argument
Take UserAgent in a handler and ask is_mobile(), browser(), platform() or robot(). Build one from headers or a string anywhere else.
-
Robots by name
Search engines, AI crawlers and agents, link previews, uptime monitors, headless browsers and HTTP clients, each by its own name.
-
Phones and tablets apart
Model codes from Apple, Samsung, Google, Xiaomi and 19 more makers tell a phone from a tablet. TVs are their own kind.
-
More than the user agent
Client hints, CloudFront viewer headers and the headers proxies put the real user agent in, plus Accept-Language in order of preference.
Hi, I'm Mischa. I've been shipping products and building ventures for over a decade. First exit at 25, second at 30. Now Partner & CPO at Ryde Ventures, an AI venture studio in Amsterdam. Currently shipping Stagent, TAP and Steddle. I write about what I learn along the way. More about me.
You might also enjoy: My simplified Ralph loop setup for Claude Code.