PHP code example of mobile-detector / php

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

    

mobile-detector / php example snippets


use MobileDetector\Detector;

$result = Detector::detect('bj', '0161159868');
// [
//   'operator' => 'MTN',
//   'country' => 'BJ',
//   'normalized' => '+2290161159868',
//   'isValid' => true
// ]

[
  'operator' => string|null,    // 'MTN', 'Moov', 'Celtiis', ou null
  'country' => string,           // Code ISO du pays (ex: 'BJ')
  'normalized' => string,        // Numéro normalisé (format international)
  'isValid' => bool,             // Si le numéro est valide
  'metadata' => array            // Métadonnées optionnelles
]
bash
composer