- Minimum PHP version: 8.0+ (was 7.2+)
- Reason: Enables modern PHP features and improved performance
- New namespace:
cbschuld\Browser - Migration path: See usage examples below
- Added return type hints to protected methods
- Impact: If you extend the
Browserclass and override protected methods, you'll need to add matching return types - Example:
protected function checkBrowserEdge(): bool(wasprotected function checkBrowserEdge())
// Old (v1.x)
$browser = new Browser();
// New (v2.x) - Recommended
use cbschuld\Browser;
$browser = new Browser();// Still works in v2.x due to automatic aliasing
$browser = new Browser();// Include the root Browser.php file
require_once '/path/to/Browser.php';
$browser = new Browser(); // Works via automatic aliasing// Include the namespaced file directly
require_once '/path/to/src/Browser.php';
use cbschuld\Browser;
$browser = new Browser();If you extend the Browser class, update your method signatures:
// Old (v1.x)
class MyBrowser extends Browser {
protected function checkBrowserEdge() {
// your implementation
}
}
// New (v2.x)
use cbschuld\Browser;
class MyBrowser extends Browser {
protected function checkBrowserEdge(): bool {
// your implementation
}
}Use the new compareVersion() method for PHP 8+ compatible version comparisons:
$browser = new Browser();
// Instead of: $browser->getVersion() >= '10.0'
// Use: $browser->compareVersion('10.0', '>=')- Better support for modern Edge user agents
- Handles Edge/, Edg/, EdgA/, and EdgiOS/ patterns
- Ensure you're using PHP 8.0+
- Run
composer installto get compatible dependencies - Update any custom test classes that extend Browser
- For Composer users: Run
composer dump-autoload - For direct includes: Ensure you're including the root
Browser.phpfile
- Replace direct version comparisons with
compareVersion()method - This handles PHP 8's stricter type comparison rules