1. Go to this page and download the library: Download pataar/browser-detect 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/ */
pataar / browser-detect example snippets
use Browser;
if (Browser::isMobile()) {
// Redirect to the mobile version of the site.
}
if (Browser::isBot()) {
echo 'Bot detected!';
}
if (Browser::isFirefox() || Browser::isOpera()) {
$response .= '<script src="firefox-fix.js"></script>';
}
if (Browser::isAndroid()) {
$response .= '<a>Install our Android App!</a>';
} elseif (Browser::isMac() && Browser::isMobile()) {
$response .= '<a>Install our iOS App!</a>';
}
use hisorange\BrowserDetect\Parser as Browser;
if (Browser::isLinux()) {
// Works without Laravel!
}
$result = Browser::detect(); // Current visitor
$result = Browser::parse('Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14');
use hisorange\BrowserDetect\Parser;
$browser = new Parser(null, null, [
'cache' => [
'interval' => 86400, // Cache TTL in seconds
],
]);
sh
php artisan vendor:publish --provider="hisorange\BrowserDetect\ServiceProvider"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.