PHP code example of ph-7 / phonedetector

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

    

ph-7 / phonedetector example snippets


use PierreHenry\PhoneDetector\PhoneDetector;

$phoneDetector = new PhoneDetector();
if ($phoneDetector->isAndroid()) {
    echo 'Your mobile phone is Android!';
}

if ($phoneDetector->isIos()) {
    echo 'Your mobile phone runs on iOS';
}


PierreHenry\PhoneDetector\PhoneDetector;

$phoneDetector = new PhoneDetector();

if ($phoneDetector->isAndroid()) {
    $url = 'https://play.google.com/store/apps/details?id=com.lifyzer';
} elseif($phoneDetector->isIos()) {
    $url = 'https://apps.apple.com/app/longer-life-lifyzer-food-scan/id1466196809';
} else {
    $url = 'https://DEFAULT-URL.example';
}

header('Location: ' . $url);