Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
damien-louis authored Dec 10, 2023
1 parent d5d9221 commit 257dd9a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,36 @@ Return `string` or `null`
If something is invalid (bad number, unknown format or region), result is `null`
```
//06 05 04 03 02
$result = \PhoneNumberOneLine::format('+33605040302', PhoneNumberOneLine::NATIONAL);
$result = \PhoneNumberShortcuts::format('+33605040302', PhoneNumberShortcuts::NATIONAL);
//+33 6 05 04 03 02
$result = \PhoneNumberOneLine::format('0605040302', PhoneNumberOneLine::INTERNATIONAL, 'FR');
$result = \PhoneNumberShortcuts::format('0605040302', PhoneNumberShortcuts::INTERNATIONAL, 'FR');
```

### Validation
Return `boolean`
```
//true
$isValid = \PhoneNumberOneLine::isValid('+33 607080910');
$isValid = \PhoneNumberShortcuts::isValid('+33 607080910');
//true
$isValid = \PhoneNumberOneLine::isValid('+33 607080910', 'FR');
$isValid = \PhoneNumberShortcuts::isValid('+33 607080910', 'FR');
//false
$isValid = \PhoneNumberOneLine::isValid('+1607080910', 'FR');
$isValid = \PhoneNumberShortcuts::isValid('+1607080910', 'FR');
```
### Region Code
Return `string` or `null`
```
//GB
$result = \PhoneNumberOneLine::getRegionCodeForNumber('+44 117 496 0123');
$result = \PhoneNumberShortcuts::getRegionCodeForNumber('+44 117 496 0123');
//FR
$result = \PhoneNumberOneLine::getRegionCodeForNumber('+33 1 02 03 04 05');
$result = \PhoneNumberShortcuts::getRegionCodeForNumber('+33 1 02 03 04 05');
//US
$result = \PhoneNumberOneLine::getRegionCodeForNumber('+12135096995');
$result = \PhoneNumberShortcuts::getRegionCodeForNumber('+12135096995');
//null
$result = \PhoneNumberOneLine::getRegionCodeForNumber('notanumber');
$result = \PhoneNumberShortcuts::getRegionCodeForNumber('notanumber');
```

0 comments on commit 257dd9a

Please sign in to comment.