PHP code example of marcover9000 / laravel-mobile-detect

1. Go to this page and download the library: Download marcover9000/laravel-mobile-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/ */

    

marcover9000 / laravel-mobile-detect example snippets


@desktop
    <img src="/path/to/high-definition/image"/>
@elsedesktop
    <img src="/path/to/handheld-optimised/image"/>
@enddesktop

use Riverskies\Laravel\MobileDetect\Facades\MobileDetect;

if (MobileDetect::isMobile()) { /* ... */ }
MobileDetect::is('iOS');

device_type(); // 'mobile' | 'tablet' | 'desktop'

MobileDetect::useAgent($userAgentCapturedFromTheRequest);

use Riverskies\Laravel\MobileDetect\Facades\MobileDetect;

MobileDetect::fake('mobile');   // also: 'tablet', 'desktop', 'bot'
MobileDetect::fake('iPhone');   // any mobiledetect rule, drives @device('iPhone')