PHP code example of gabeta / gsm-detector

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

    

gabeta / gsm-detector example snippets


use Gabeta\GsmDetector\GsmDetector;

$gsmDetector = new GsmDetector([
    'orange' => [
        'fix' => ['22', '35'],
        'mobile' => ['09', '88']
    ],
    'mtn' => [
        'fix' => ['23', '24'],
        'mobile' => ['04', '05']
    ],
]);


use Gabeta\GsmDetector\GsmDetector;

$gsmDetector = new GsmDetector([
    'orange' => [
        'fix' => ['22', '35'],
        'mobile' => ['09', '88']
    ],
    'mtn' => [
        'fix' => ['23', '24'],
        'mobile' => ['04', '05']
    ],
]);

$gsmDetector->isMtn('04000000') // true

$gsmDetector->isMtn('24000000') // true
        
$gsmDetector->isMtn('35000000') // false
        
$gsmDetector->isMtn('08000000') // false

$gsmDetector->isMtn('23000000') // true

$gsmDetector->isOrange('88000000') // true

$gsmDetector->isOrange('09000000') // true

$gsmDetector->isOrange('22000000') // true

$gsmDetector->isMtnFix('23000000') // true

$gsmDetector->isMtnFix('24000000') // true

$gsmDetector->isMtnFix('04000000') // false

$gsmDetector->isMtnMobile('04000000') // true

$gsmDetector->isOrangeFix('22000000') // true

$gsmDetector->isOrangeFix('35000000') // true

$gsmDetector->isOrangeMobile('35000000') // false

/**
* OTHERS METHODS
**/

$gsmDetector->getGsmName('04000000'); // mtn

$gsmDetector->isMobile('04000000'); // true

$gsmDetector->isFix('04000000'); // false