Releases: Cuteminded/agent
V3.0.3
Updated src/Agent.php to improve consistency and remove redundant mappings in operating system detection:
Renamed the 'OS X' key to 'macOS'
Updated its property mapping to 'Mac OS X [VER]'
Consolidated Windows mappings by:
Mapping 'Windows' to 'Windows NT'
Removing the duplicate 'Windows NT' key
These changes streamline OS naming conventions and eliminate duplicate entries for more consistent identification.
V3.0.2
Use mobile-specific rules for UA matching
V3.0.1
Release Notes
Refactor: Agent Detection Modernization (PHP 8+)
This update delivers a comprehensive refactor of the Agent detection layer, improving readability, type safety, and overall correctness while aligning the codebase with modern PHP 8 standards.
Modern PHP 8 Enhancements
- Added strict type hints and return types across the class.
- Introduced typed properties for better clarity and reliability.
- Made
crawlerDetectnullable for safer instantiation. - Improved
__call()implementation usingstr_starts_with()and proper delegation tois().
Detection Rule Cleanup & Unification
-
Standardized and renamed helper methods:
getAllBrowsers()getAllOperatingSystems()getAllProperties()getPlatforms()getDesktopDevices()
-
Delegated rule retrieval directly to parent detection rule getters.
-
Refactored
mergeRules()to properly handle array-based rule values.
Improved User-Agent Matching
- Replaced loose matching with stricter
preg_match()usage. - Added support for array-aware pattern matching.
- Simplified device and robot detection logic.
- Removed deprecated User-Agent and header parameters.
- Switched to
getHttpHeaders()for improved CloudFront detection handling.
Version Handling Improvements
- Introduced
VERSION_REGEXconstant for consistent parsing. - Added
prepareVersionNo()for cleaner normalization. - Strengthened version extraction logic to reduce false positives and malformed results.
Result
This refactor significantly improves maintainability, safety, and detection accuracy while modernizing the implementation for PHP 8+. The internal API is now more consistent, predictable, and resilient against malformed input.
No breaking changes to public-facing APIs unless custom extensions relied on deprecated parameters.