Skip to content

Releases: Cuteminded/agent

V3.0.3

09 Apr 09:11

Choose a tag to compare

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

19 Feb 15:35

Choose a tag to compare

Use mobile-specific rules for UA matching

V3.0.1

19 Feb 13:48

Choose a tag to compare

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 crawlerDetect nullable for safer instantiation.
  • Improved __call() implementation using str_starts_with() and proper delegation to is().

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_REGEX constant 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.