1. Go to this page and download the library: Download kodhe/agent library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Kodhe\Agent\Collections\BrowserCollection;
$collection = new BrowserCollection();
$collection->add('MyBrowser', 'My Custom Browser');
$agent = new Agent();
$agent->getBrowserDriver()->setCollection($collection);
use Kodhe\Agent\Contracts\AgentDriverInterface;
use Kodhe\Agent\Parsers\UserAgentParser;
class CustomDriver implements AgentDriverInterface {
private $parser;
public function __construct(UserAgentParser $parser) {
$this->parser = $parser;
$this->detect();
}
public function detect(): void {
// Custom detection logic
}
public function getValue(): string {
return 'custom_value';
}
public function isMatch(?string $key = null): bool {
return true;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.