### Install Browser Detect Package Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Install the package using Composer. This command adds the browser-detect package to your project dependencies. ```sh composer require hisorange/browser-detect ``` -------------------------------- ### Browser::deviceFamily() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the vendor of the device. ```APIDOC ## Browser::deviceFamily() ### Description Gets the vendor of the device (e.g., Samsung, Apple, Huawei). ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The device vendor. ``` -------------------------------- ### Browser::platformFamily() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the vendor of the operating system. ```APIDOC ## Browser::platformFamily() ### Description Gets the vendor of the operating system (e.g., Linux, Windows, Mac). ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The operating system vendor. ``` -------------------------------- ### Browser::deviceModel() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the brand name of the device. ```APIDOC ## Browser::deviceModel() ### Description Gets the brand name of the device (e.g., iPad, iPhone, Nexus). ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The device brand name. ``` -------------------------------- ### Browser::platformVersion() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the human-friendly version string of the operating system. ```APIDOC ## Browser::platformVersion() ### Description Gets the human-friendly version string of the operating system (e.g., XP, Vista, 10). ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The operating system version string. ``` -------------------------------- ### Browser::browserVersion() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the human-friendly version string of the browser. ```APIDOC ## Browser::browserVersion() ### Description Gets the human-friendly version string of the browser. ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The browser version string. ``` -------------------------------- ### Browser::platformName() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the human-friendly name of the operating system. ```APIDOC ## Browser::platformName() ### Description Gets the human-friendly name of the operating system (e.g., Windows XP, Mac 10). ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The human-friendly operating system name. ``` -------------------------------- ### Browser::browserFamily() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the vendor of the browser. ```APIDOC ## Browser::browserFamily() ### Description Gets the vendor of the browser (e.g., Chrome, Firefox, Opera). ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The browser vendor. ``` -------------------------------- ### Browser::browserEngine() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the rendering engine of the browser. ```APIDOC ## Browser::browserEngine() ### Description Gets the rendering engine of the browser (e.g., Blink, WebKit, Gecko). ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The browser rendering engine. ``` -------------------------------- ### Browser::platformVersionMinor() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the minor semantic version of the operating system. ```APIDOC ## Browser::platformVersionMinor() ### Description Gets the minor semantic version of the operating system. ### Method N/A (Function Call) ### Parameters None ### Response - **integer**: The minor version number. ``` -------------------------------- ### Browser::platformVersionMajor() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the major semantic version of the operating system. ```APIDOC ## Browser::platformVersionMajor() ### Description Gets the major semantic version of the operating system. ### Method N/A (Function Call) ### Parameters None ### Response - **integer**: The major version number. ``` -------------------------------- ### Browser::platformVersionPatch() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the patch semantic version of the operating system. ```APIDOC ## Browser::platformVersionPatch() ### Description Gets the patch semantic version of the operating system. ### Method N/A (Function Call) ### Parameters None ### Response - **integer**: The patch version number. ``` -------------------------------- ### Browser::browserVersionPatch() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the patch semantic version of the browser. ```APIDOC ## Browser::browserVersionPatch() ### Description Gets the patch semantic version of the browser. ### Method N/A (Function Call) ### Parameters None ### Response - **integer**: The patch version number. ``` -------------------------------- ### Browser::browserVersionMajor() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the major semantic version of the browser. ```APIDOC ## Browser::browserVersionMajor() ### Description Gets the major semantic version of the browser. ### Method N/A (Function Call) ### Parameters None ### Response - **integer**: The major version number. ``` -------------------------------- ### Browser::browserVersionMinor() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the minor semantic version of the browser. ```APIDOC ## Browser::browserVersionMinor() ### Description Gets the minor semantic version of the browser. ### Method N/A (Function Call) ### Parameters None ### Response - **integer**: The minor version number. ``` -------------------------------- ### Browser::browserName() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Gets the human-friendly name of the browser, including its version. ```APIDOC ## Browser::browserName() ### Description Gets the human-friendly name of the browser, including its version (e.g., Firefox 3.6, Chrome 42). ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The human-friendly browser name and version. ``` -------------------------------- ### Parse a Specific User Agent String Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Utilize the Browser facade's parse function to get browser details from a user agent string other than the current user's. Caching is applied. ```php // If You wanna get browser details from a user agent other than the current user call the parse function. $result = Browser::parse('Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14'); ``` -------------------------------- ### Browser::isIEVersion() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Compares the browser's IE version to a given version. ```APIDOC ## Browser::isIEVersion() ### Description Compares the browser's IE version to a given version. ### Method N/A (Function Call) ### Parameters - **version** (string): The IE version to compare against. ### Response - **boolean**: True if the browser is IE and matches the version, false otherwise. ``` -------------------------------- ### Publish Configuration File Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Run this Artisan command to copy the configuration file to your Laravel application's config directory. ```sh php artisan vendor:publish ``` -------------------------------- ### Browser::isDesktop() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the current visitor's device is a desktop computer. ```APIDOC ## Browser::isDesktop() ### Description Checks if the current visitor's device is a desktop computer. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the device is a desktop, false otherwise. ``` -------------------------------- ### Browser::isWindows() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the operating system is Windows. ```APIDOC ## Browser::isWindows() ### Description Checks if the operating system is Windows. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the OS is Windows, false otherwise. ``` -------------------------------- ### Standalone Parser with Custom Cache Configuration Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Instantiate the Parser class directly and provide custom cache settings for standalone mode. The cache interval can be overridden. ```php use hisorange\BrowserDetect\Parser; $browser = new Parser(null, null, [ 'cache' => [ 'interval' => 86400 // This will override the default configuration. ] ]); $result = $browser->detect(); ``` -------------------------------- ### Browser::isLinux() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the operating system is Linux-based. ```APIDOC ## Browser::isLinux() ### Description Checks if the operating system is Linux-based. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the OS is Linux-based, false otherwise. ``` -------------------------------- ### Browser::deviceType() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Returns an enumerated string representing the device type: Mobile, Tablet, Desktop, or Bot. ```APIDOC ## Browser::deviceType() ### Description Returns an enumerated string representing the device type. ### Method N/A (Function Call) ### Parameters None ### Response - **string**: One of 'Mobile', 'Tablet', 'Desktop', or 'Bot'. ``` -------------------------------- ### Detect Current User's Browser Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Use the Browser facade to detect the current user's browser agent. This is the default behavior when calling the detect function. ```php // When You call the detect function You will get a result object, from the current user's agent. $result = Browser::detect(); ``` -------------------------------- ### Browser::isOpera() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the browser is Opera. ```APIDOC ## Browser::isOpera() ### Description Checks if the browser is Opera. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the browser is Opera, false otherwise. ``` -------------------------------- ### Detect Device Type and Browser Information Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Use the Browser facade to check if the visitor is on a mobile, tablet, or desktop device. You can also check if the visitor is a bot or specific browsers like Firefox or Opera. ```php use Browser; // Determine the user's device type is simple as this: $isMobile = Browser::isMobile(); Browser::isTablet(); Browser::isDesktop(); if (Browser::isMobile()) { // Redirect to the mobile version of the site. } // Every wondered if it is a bot who loading Your page? if (Browser::isBot()) { echo 'No need to wonder anymore!'; } // Check for common vendors. if (Browser::isFirefox() || Browser::isOpera()) { $response .= ''; } // Sometimes You may want to serve different content based on the OS. if (Browser::isAndroid()) { $response .= 'Install our Android App!'; } elseif (Browser::isMac() && Browser::isMobile()) { $response .= 'Install our iOS App!'; } ``` -------------------------------- ### Browser::isMac() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the operating system is Mac or iOS based. ```APIDOC ## Browser::isMac() ### Description Checks if the operating system is Mac or iOS based. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the OS is Mac or iOS based, false otherwise. ``` -------------------------------- ### Standalone Browser Detection without Laravel Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Use the Parser class statically for browser detection when not using the Laravel framework. This allows for flexible integration into various PHP projects. ```php use hisorange\BrowserDetect\Parser as Browser; if (Browser::isLinux()) { // Works as well! } ``` -------------------------------- ### Browser::userAgent() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Retrieves the current visitor's HTTP_USER_AGENT string. ```APIDOC ## Browser::userAgent() ### Description Retrieves the current visitor's HTTP_USER_AGENT string. ### Method N/A (Function Call) ### Parameters None ### Response - **string**: The HTTP_USER_AGENT string. ``` -------------------------------- ### Browser::isAndroid() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the operating system is Android. ```APIDOC ## Browser::isAndroid() ### Description Checks if the operating system is Android. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the OS is Android, false otherwise. ``` -------------------------------- ### Browser::isSafari() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the browser is Safari. ```APIDOC ## Browser::isSafari() ### Description Checks if the browser is Safari. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the browser is Safari, false otherwise. ``` -------------------------------- ### Browser::isTablet() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the current visitor's device is a tablet device. ```APIDOC ## Browser::isTablet() ### Description Checks if the current visitor's device is a tablet device. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the device is a tablet, false otherwise. ``` -------------------------------- ### Browser::isChrome() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the browser is Chrome. ```APIDOC ## Browser::isChrome() ### Description Checks if the browser is Chrome. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the browser is Chrome, false otherwise. ``` -------------------------------- ### Browser::isFirefox() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the browser is Firefox. ```APIDOC ## Browser::isFirefox() ### Description Checks if the browser is Firefox. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the browser is Firefox, false otherwise. ``` -------------------------------- ### Browser::isEdge() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the browser is Microsoft Edge. ```APIDOC ## Browser::isEdge() ### Description Checks if the browser is Microsoft Edge. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the browser is Edge, false otherwise. ``` -------------------------------- ### Browser::isIE() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the browser is an Internet Explorer or Trident-based browser. ```APIDOC ## Browser::isIE() ### Description Checks if the browser is an Internet Explorer or Trident-based browser. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the browser is IE or Trident-based, false otherwise. ``` -------------------------------- ### Browser::isBot() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the current visitor is a crawler or bot. ```APIDOC ## Browser::isBot() ### Description Checks if the current visitor is a crawler or bot. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the visitor is a bot, false otherwise. ``` -------------------------------- ### Browser::isMobile() Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Checks if the current visitor's device is a mobile device. ```APIDOC ## Browser::isMobile() ### Description Checks if the current visitor's device is a mobile device. ### Method N/A (Function Call) ### Parameters None ### Response - **boolean**: True if the device is mobile, false otherwise. ``` -------------------------------- ### Blade Directives for Device Detection Source: https://github.com/hisorange/browser-detect/blob/stable/README.md Utilize Blade directives like @mobile, @tablet, and @desktop to conditionally render content based on the visitor's device type. You can also use @browser('key') to check specific browser properties. ```blade @mobile
This is the MOBILE template!
@include('your-mobile-template') @endmobile @tabletThis is the TABLET template!
@endtablet @desktopThis is the DESKTOP template!
@enddesktop {-- Every result key is supported --} @browser('isBot')Bots are identified too :)
@endbrowser ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.