Skip to content

Commit 22ecca2

Browse files
authored
Merge branch 'main' into dependabot/composer/phpunit/phpunit-10.5.62
2 parents 21afbdf + 3b9c353 commit 22ecca2

15 files changed

Lines changed: 599 additions & 411 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install Composer
1919
uses: php-actions/composer@v6
2020
with:
21-
php_version: 8.2
21+
php_version: 8.4
2222
php_extensions: mbstring xdebug
2323

2424
- name: PHPUnit Tests

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ To use AgentZero:
2222
```php
2323
$ua = $_SERVER['HTTP_USER_AGENT']; // or whatever UA you want e.g:
2424
$ua = 'Mozilla/5.0 (Linux; Android 13; Pixel 7 Pro Build/TD1A.220804.031; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 Instagram 301.1.0.33.110 Android (33/13; 420dpi; 1080x2116; Google/google; Pixel 7 Pro; cheetah; cheetah; en_GB; 517986703)';
25-
$browser = \hexydec\agentzero\agentzero::parse($ua);
25+
if (($browser = \hexydec\agentzero\agentzero::parse($ua)) !== false) {
26+
// use $browser
27+
}
2628
```
29+
30+
`parse()` returns `false` if the string is empty, longer than 2000 characters, or produces no recognisable tokens. Always check the return value before using the object.
2731
The returned value will be something like:
2832

2933
```php
@@ -115,9 +119,9 @@ $config = [
115119
];
116120
$az = \hexydec\agentzero\agentzero::parse($_SERVER['HTTP_USER_AGENT'], [], $config);
117121
var_dump(
118-
$ua->browserstatus, // either "canary", "beta", "latest", "previous", "outdated" (release over 2 years ago), "legacy" (released over 5 years ago)
119-
$ua->browserreleased, // the date the browser was released
120-
$us->browserlatest // the latest version number of the browser
122+
$az->browserstatus, // "nightly", "canary", "beta", "current", "previous", "outdated" (2+ years old), or "legacy" (5+ years old)
123+
$az->browserreleased, // date the browser version was released, e.g. "2024-01-15"
124+
$az->browserlatest // latest known version number of the browser
121125
);
122126

123127
```

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
}
1313
],
1414
"keywords": ["php", "browser", "user-agents"],
15-
"minimum-stability": "beta",
15+
"minimum-stability": "stable",
1616
"require": {
1717
"php": ">=8.1"
1818
},
1919
"autoload": {
2020
"classmap": ["src/", "tests/"]
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "10.5.62",
23+
"phpunit/phpunit": "^12.5.8",
2424
"phpstan/phpstan": "^1.10"
2525
}
2626
}

0 commit comments

Comments
 (0)