Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nguyenanhung/vn-telco-phonenumber
Library detect carrier Vietnam telco: Viettel, Vina, MobiFone... & Format Phone number
https://github.com/nguyenanhung/vn-telco-phonenumber
hungna library-phone-number mobifone nguyenanhung phone-number telco thudomultimedia vietnamobile viettel vina
Last synced: about 1 month ago
JSON representation
Library detect carrier Vietnam telco: Viettel, Vina, MobiFone... & Format Phone number
- Host: GitHub
- URL: https://github.com/nguyenanhung/vn-telco-phonenumber
- Owner: nguyenanhung
- License: gpl-3.0
- Created: 2018-05-17T04:31:40.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-21T19:53:29.000Z (about 2 months ago)
- Last Synced: 2024-10-02T08:23:37.174Z (about 1 month ago)
- Topics: hungna, library-phone-number, mobifone, nguyenanhung, phone-number, telco, thudomultimedia, vietnamobile, viettel, vina
- Language: PHP
- Homepage:
- Size: 864 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vietnam Phone Number
[![Latest Stable Version](https://img.shields.io/packagist/v/nguyenanhung/vn-telco-phonenumber.svg?style=flat-square)](https://packagist.org/packages/nguyenanhung/vn-telco-phonenumber)
[![Total Downloads](https://img.shields.io/packagist/dt/nguyenanhung/vn-telco-phonenumber.svg?style=flat-square)](https://packagist.org/packages/nguyenanhung/vn-telco-phonenumber)
[![Daily Downloads](https://img.shields.io/packagist/dd/nguyenanhung/vn-telco-phonenumber.svg?style=flat-square)](https://packagist.org/packages/nguyenanhung/vn-telco-phonenumber)
[![Monthly Downloads](https://img.shields.io/packagist/dm/nguyenanhung/vn-telco-phonenumber.svg?style=flat-square)](https://packagist.org/packages/nguyenanhung/vn-telco-phonenumber)
[![License](https://img.shields.io/packagist/l/nguyenanhung/vn-telco-phonenumber.svg?style=flat-square)](https://packagist.org/packages/nguyenanhung/vn-telco-phonenumber)
[![PHP Version Require](https://img.shields.io/packagist/dependency-v/nguyenanhung/vn-telco-phonenumber/php)](https://packagist.org/packages/nguyenanhung/vn-telco-phonenumber)Library detect carrier Vietnam telco: Viettel, VinaPhone, MobiFone, Vietnamobile ...
Format Phone number
Library use `libphonenumber` by Google, version PHP by `giggsey`
## Version
- [x] All version `v1.x`, `v2.x` support PHP `>=5.6`
- [x] All version `v3.x` support PHP `>=7.0`## Installation
**Manual install**
Step 1: Save library to your project
```shell
cd /your/to/path
wget https://github.com/nguyenanhung/vn-telco-phonenumber/archive/master.zip
unzip master.zip
```Step 2: Init to Project
```php
getVersion(); // Print: 1.0.9
```**Valid Phone Number**
```php
is_valid($my_number, 'VN'); // Print: true
echo $phone->is_valid($my_number_2, 'VN'); // Print: false
```**Get National Number**
```php
get_national_number($my_number); // Print: 1632953760
```**Check is Possible Number**
```php
is_possible_number($my_number, 'VN'); // Print: true
echo $phone->is_possible_number($my_number_2, 'VN'); // Print: false
```**Format Phone number**
```php
format($my_number); // Print: 841632953760
echo $phone->format($my_number, 'vn'); // Print: 01632953760
echo $phone->format($my_number, 'vn_human'); // Print: 0163 295 3760
echo $phone->format($my_number, 'hidden'); // Print: 0163***3760```
**Detect Carrier from Phone number**
```php
detect_carrier($my_number); // Print: Viettel Mobile
echo $phone->detect_carrier($my_number, 'id'); // Print: 2
echo $phone->detect_carrier($my_number, 'name'); // Print: Viettel
echo $phone->detect_carrier($my_number, 'short_name'); // Print: viettel
```**Conver Old Number to New Number (or New Number to Old Number)**
```php
vn_convert_phone_number($my_number, 'old'); // Print: 841632953760
echo $phone->vn_convert_phone_number($my_number, 'new'); // Print: 84332953760echo $phone->vn_convert_phone_number($my_number, 'old', 'vn'); // Print: 01632953760
echo $phone->vn_convert_phone_number($my_number, 'new', 'vn'); // Print: 0332953760```
**Return Array Old number and New number**
```php
vn_phone_number_old_and_new($my_number); // Print: ["841632953760", "84332953760"]
echo $phone->vn_phone_number_old_and_new($my_number, 'vn'); // Print: ["01632953760", "0332953760"]...
// other format is the same $phone->format() method: VN, VN_HUMAN, E164, INTERNATIONAL, NATIONAL, RFC3966, HIDDEN, HIDDEN_HEAD, HIDDEN_MIDDLE, HIDDEN_END
```## Contact
If any question & request, please contact following infomation
| Name | Email | Skype | Facebook |
| ----------- | -------------------- | ---------------- | ------------- |
| Hung Nguyen | [email protected] | nguyenanhung5891 | @nguyenanhung |From Hanoi with Love <3