Skip to content

Conversation

@cbschuld
Copy link
Owner

@cbschuld cbschuld commented Sep 1, 2025

After a longer hiatus on Browser.php I have updated to cover comments and in attempt to reduce the need for forks in the future.

My plan is to leave this PR open for a few days to see if anyone has comments on the updates and then I'll release it as v2.

[2.0.0] - 2025-08-31

Added

  • PSR-4 autoloading with cbschuld namespace
  • Return type declarations on key methods (setVersion, checkBrowserEdge, etc.)
  • compareVersion() method for PHP 8+ compatible version comparisons
  • Enhanced Edge browser detection (supports Edge/, Edg/, EdgA/, EdgiOS/ patterns)
  • Root-level Browser.php shim for non-Composer backward compatibility
  • GitHub Actions CI pipeline (replaces Travis CI)
  • Support metadata in composer.json
  • Comprehensive upgrade documentation (UPGRADING.md)

Changed

  • BREAKING: Minimum PHP version is now 8.0 (was 7.2)
  • BREAKING: Added return type declarations to key methods (may affect extenders)
  • BREAKING: Class is now namespaced as cbschuld\Browser
  • Updated PHPUnit to 9.6 for broad PHP 8.x compatibility
  • Updated phpunit.xml.dist to PHPUnit 9.6 schema
  • Fixed fgetcsv escape parameter for PHP 8.1+ compatibility
  • Removed composer.lock from repository (library best practice)

Removed

  • Support for PHP 7.x
  • Travis CI configuration (.travis.yml)
  • Composer branch alias

Migration

  • See UPGRADING.md for detailed migration instructions
  • Backward compatibility maintained via automatic class aliasing
  • Non-Composer users can still use direct includes

Breaking Changes

PHP Version Requirement

  • Minimum PHP version: 8.0+ (was 7.2+)
  • Reason: Enables modern PHP features and improved performance

Namespace Introduction

  • New namespace: cbschuld\Browser
  • Migration path: See usage examples below

Return Type Declarations

  • Added return type hints to protected methods
  • Impact: If you extend the Browser class and override protected methods, you'll need to add matching return types
  • Example: protected function checkBrowserEdge(): bool (was protected function checkBrowserEdge())

This was referenced Sep 1, 2025
@cbschuld
Copy link
Owner Author

cbschuld commented Sep 1, 2025

fixes #75

@cbschuld cbschuld mentioned this pull request Sep 1, 2025
@cbschuld
Copy link
Owner Author

cbschuld commented Sep 1, 2025

fixes #96

@cbschuld cbschuld merged commit bf4be5f into master Sep 4, 2025
4 checks passed
@cbschuld cbschuld deleted the modernization branch September 4, 2025 16:15
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.

2 participants