PHP code example of rupeshdahal / nepal-mobile-operators

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

    

rupeshdahal / nepal-mobile-operators example snippets


use RupeshDai\nepalimobileoperator\src\Facades\NepalMobileOperators;

// Get the operator name
$operator = NepalMobileOperators::getOperator('9841234567'); 
// Returns: "Ntc (Namaste SIM)"

// Check if a number is valid
$isValid = NepalMobileOperators::isValid('9841234567');
// Returns: true

// Get detailed information
$details = NepalMobileOperators::getOperatorDetails('9841234567');
// Returns: [
//    'operator' => 'Ntc (Namaste SIM)',
//    'prefixes' => ['984', '985', '986', '976'],
//    'technology' => 'GSM'
// ]

use Neputer\NepalOperatorIdentifier\NepalMobileOperators;

$detector = new NepalMobileOperators();
$operator = $detector->getOperator('9841234567');

// config/nepalmobileoperators.php

return [
    'custom_operators' => [
        'New Operator' => [
            'prefixes' => ['990'],
            'technology' => 'GSM'
        ],
    ],
    
    'validation' => [
        'strict_length' => true,
    ],
];
bash
php artisan vendor:publish --provider="RupeshDai\NepalMobileOperators\NepalMobileOperatorsServiceProvider" --tag="config"