rupeshdahal/nepal-mobile-operators
最新稳定版本:v1.0.2
Composer 安装命令:
composer require rupeshdahal/nepal-mobile-operators
包简介
A Laravel package to identify mobile operators in Nepal based on number prefixes
README 文档
README
A Laravel package to identify mobile operators in Nepal based on number prefixes.
Installation
You can install the package via composer:
composer require rupeshdahal/nepal-mobile-operators
The package will automatically register its service provider.
You can publish the configuration file with:
php artisan vendor:publish --provider="RupeshDai\NepalMobileOperators\NepalMobileOperatorsServiceProvider" --tag="config"
Usage
Basic Usage
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' // ]
Direct Class Usage
If you prefer not to use the facade, you can also use the class directly:
use Neputer\NepalOperatorIdentifier\NepalMobileOperators; $detector = new NepalMobileOperators(); $operator = $detector->getOperator('9841234567');
Available Operators
The package currently supports the following operators:
| Operator | Prefixes | Technology |
|---|---|---|
| Ntc (Namaste SIM) | 984, 985, 986, 976 | GSM |
| Ntc (Earlier CDMA, now with GSM) | 974, 975 | CDMA/GSM |
| Ncell | 980, 981, 982, 970 | GSM |
| Smart Cell | 961, 962, 988 | GSM |
| UTL | 972 | CDMA |
| Hello Mobile | 963 | GSM |
Number Format Handling
The package handles various phone number formats:
- Standard 10-digit numbers:
9841234567 - Numbers with country code:
+9779841234567or9779841234567 - Numbers with leading zero:
09841234567 - Formatted numbers:
984-123-4567or984 123 4567
Custom Configuration
After publishing the config file, you can add custom operators or modify validation settings:
// config/nepalmobileoperators.php return [ 'custom_operators' => [ 'New Operator' => [ 'prefixes' => ['990'], 'technology' => 'GSM' ], ], 'validation' => [ 'strict_length' => true, ], ];
Testing
composer test
Contributing
Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-15