fawkescreatives / myanmar-phone
This package is for building easy to do Myanmar phone number in laravel.
v1.1.0
2022-02-03 16:28 UTC
Requires
- php: ^7.3|^8.0
- giggsey/libphonenumber-for-php: ^8.0
- illuminate/support: ^8.0|^9.0
Requires (Dev)
- nunomaduro/collision: ^5.10|^6.1
- nunomaduro/larastan: ^1.0|^2.0
- orchestra/testbench: ^6.22|^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
Myanmar phone number များနှင့်ပတ်သက်ပြီး format လုပ်ခြင်းနှင့် check လုပ်နိုင်ရန်ရည်ရွယ်ပြီးတည်ဆောက်သည်။
Table of Contents
Installation
Composer ကိုသုံးပြီး Install လုပ်ပါ။
composer require fawkescreatives/myanmar-phone
Laravel Package Auto-Discovery မလုပ်လျှင် config/app.php
file ထဲမှ providers
ထဲမှာ ဒီလိုသွားထည့်ပါ။
/* * Package Service Providers... */ MyanmarPhone\MyanmarPhoneServiceProvider::class,
Configuration
php artisan vendor:publish --provider="MyanmarPhone\MyanmarPhoneServiceProvider"
config/myanmar_phone.php
တွင် default format standard ကိုသတ်မှတ်နိုင်သည်။
Usage
- Option 1: Use Injection
use MyanmarPhone\MyanmarPhone; public function index(MyanmarPhone $service) { $phone = '09251234567'; return $service->make($phone)->getPhoneNumber(); }
- Option 2: Use Facade
use MyanmarPhone\Facades\MyanPhone; public function index() { $phone = '09251234567'; return MyanPhone::make($phone)->getPhoneNumber(); }
Validation
eg..,
Validator::make($data, [ 'phone_number' => [ 'myanmar_phone' ], ]);
Functions
eg..,
MyanPhone::make($phone)->format(2); // look format number in config
- format($format)
- formatE164()
- formatInternational()
- formatRFC3966(string $separator = null)
- formatNational(string $separator = null)
- operator($number = null)
- telecom($number = null)
- isTelenor($number = null)
- isOoredoo($number = null)
- isMpt($number = null)
- isMyTel($number = null)
- isMec($number = null)
- getCountryCode()
- getStrPhoneNumber()
- getPhoneNumber($leadingZero = true)
Testing
You can run the tests with:
composer test
License
The MIT License (MIT). Please see License File for more information.