Skip to content

feat!: extend browser, OS, device and in-app detection#11

Merged
pataar merged 1 commit into
6.xfrom
feat/extended-detection
Mar 20, 2026
Merged

feat!: extend browser, OS, device and in-app detection#11
pataar merged 1 commit into
6.xfrom
feat/extended-detection

Conversation

@pataar
Copy link
Copy Markdown
Owner

@pataar pataar commented Mar 20, 2026

Summary

  • Breaking: isMac() no longer returns true for iOS/iPadOS — new isiOS() method takes over
  • Breaking: deviceType() now returns TV, Console, Wearable in addition to existing values
  • Adds 5 new browser detectors: Brave, Vivaldi, Samsung Internet, Arc, DuckDuckGo
  • Adds 3 new OS detectors: iOS (split from Mac), ChromeOS, HarmonyOS
  • Adds 3 new device type detectors: TV, Console, Wearable
  • Expands in-app detection with 8 new apps (Facebook, Instagram, TikTok, Snapchat, LinkedIn, Telegram, Line, Pinterest)
  • Fixes pre-existing bugs: iPadOS undetected, Samsung Internet misidentified as Chrome, TVs/consoles/wearables defaulting to Desktop
  • Cleans up pre-existing code quality issues (dead code, redundant calls, overly broad substring matches)
  • Test suite grows from 79 → 116 tests, 199 → 360 assertions
  • PHPStan level max, zero errors

See UPGRADING.md for migration details.

Test plan

  • composer test — 116 tests, 360 assertions pass
  • composer analyse — PHPStan level max, 0 errors
  • Functional verification with real UAs for all new detection scenarios
  • Verified exclusivity: new browser/OS flags don't trigger unrelated flags
  • Verified breaking change: iPad UA → isiOS()=true, isMac()=false

@pataar pataar force-pushed the feat/extended-detection branch from 2a14d18 to 6267345 Compare March 20, 2026 12:01
BREAKING CHANGE: `isMac()` no longer returns `true` for iOS or iPadOS.
Use the new `isiOS()` method instead. `deviceType()` now returns `TV`,
`Console`, and `Wearable` in addition to the existing values.

New browser detection:
- isBrave(), isVivaldi(), isSamsungBrowser(), isArc(), isDuckDuckGo()

New OS detection:
- isiOS() (split from isMac), isChromeOS(), isHarmonyOS()

New device type detection:
- isTV(), isConsole(), isWearable()

Expanded in-app detection:
- Facebook, Instagram, TikTok, Snapchat, LinkedIn, Telegram, Line,
  Pinterest (in addition to existing WebView, Twitter, WeChat)

Also fixes pre-existing issues:
- iPadOS was not matched by any OS flag
- Samsung Internet was misidentified as Chrome
- Smart TVs, consoles, wearables all defaulted to Desktop
- deviceType() used stringly-typed magic dispatch
- parseVersion() produced dead version string overwritten downstream
- skipBotDetection() called on every request instead of once
- IE match used overly broad 'ie' substring (now word-boundary)
- detectIsInApp() re-fetched agent from payload unnecessarily
@pataar pataar force-pushed the feat/extended-detection branch from 6267345 to e3e849a Compare March 20, 2026 12:23
@pataar pataar merged commit 6e821e7 into 6.x Mar 20, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant