49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
|
<?php declare(strict_types=1);
|
||
|
|
||
|
/*
|
||
|
* This file is part of sikofitt/user-agent
|
||
|
*
|
||
|
* Copyleft (C) 2017 http://sikofitt.com sikofitt@gmail.com
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
require __DIR__.'/../vendor/autoload.php';
|
||
|
|
||
|
use Sikofitt\UserAgent\UserAgent;
|
||
|
|
||
|
// Simple default example
|
||
|
$userAgent = UserAgent::create();
|
||
|
// PHP/7.1-70110 (sikofitt/user-agent; Linux x86_64)
|
||
|
// PHP/7.1.10-1+ubuntu17.04.1+deb.sury.org+1;
|
||
|
// guzzlehttp/6.2.1 curl/7.52.1 (https://packagist.org/sikofitt/user-agent)
|
||
|
|
||
|
// If guzzle is not installed the user agent would be -
|
||
|
// PHP/7.1-70110 (sikofitt/user-agent; Linux x86_64)
|
||
|
// PHP/7.1.10-1+ubuntu17.04.1+deb.sury.org+1;
|
||
|
// (https://packagist.org/sikofitt/user-agent)
|
||
|
|
||
|
// Extending
|
||
|
$ua = new class extends UserAgent {
|
||
|
protected static $format = 'PHP/%d.%d.%d';
|
||
|
protected static $params = [
|
||
|
PHP_MAJOR_VERSION,
|
||
|
PHP_MINOR_VERSION,
|
||
|
PHP_RELEASE_VERSION
|
||
|
];
|
||
|
};
|
||
|
|
||
|
$userAgent2 = $ua::create();
|
||
|
// PHP/7.1.10
|