Skip to content

Commit 7a66a13

Browse files
committed
Update documentation for 7.0 release
1 parent 5acfffd commit 7a66a13

File tree

4 files changed

+39
-18
lines changed

4 files changed

+39
-18
lines changed

LICENSE

+2-1
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,5 @@
173173
incurred by, or claims asserted against, such Contributor by reason
174174
of your accepting any such warranty or additional liability.
175175

176-
END OF TERMS AND CONDITIONS
176+
END OF TERMS AND CONDITIONS
177+

README.md

+33-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![License](https://poser.pugx.org/giggsey/libphonenumber-for-php/license.svg)](https://packagist.org/packages/giggsey/libphonenumber-for-php)
66

77
## What is it?
8-
A PHP library for parsing, formatting, storing and validating international phone numbers. This library is based on Google's [libphonenumber](https://code.google.com/p/libphonenumber/) and forked from a version by [Davide Mendolia](https://github.com/davideme/libphonenumber-for-PHP).
8+
A PHP library for parsing, formatting, storing and validating international phone numbers. This library is based on Google's [libphonenumber](https://code.google.com/p/libphonenumber/) and was forked from a version by [Davide Mendolia](https://github.com/davideme/libphonenumber-for-PHP).
99

1010

1111
# Highlights of functionality
@@ -15,6 +15,7 @@ A PHP library for parsing, formatting, storing and validating international phon
1515
* `getExampleNumber`/`getExampleNumberByType` - provides valid example numbers for all countries/regions, with the option of specifying which type of example phone number is needed.
1616
* `isValidNumber` - full validation of a phone number for a region using length and prefix information.
1717
* PhoneNumberOfflineGeocoder - provides geographical information related to a phone number.
18+
* PhoneNumberToTimeZonesMapper - provides timezone information related to a phone number.
1819
* PhoneNumberToCarrierMapper - provides carrier information related to a phone number.
1920

2021
## Installation
@@ -26,11 +27,18 @@ The PECL [mbstring](http://php.net/mbstring) extension is required for this libr
2627
```json
2728
{
2829
"require": {
29-
"giggsey/libphonenumber-for-php": "~6.0"
30+
"giggsey/libphonenumber-for-php": "~7.0"
3031
}
3132
}
3233
```
3334

35+
## Versioning
36+
37+
This library will try to follow the same version numbers as Google. There could be additional releases where needed to fix critical issues that can not wait until the next release from Google.
38+
39+
This does mean that this project will not follow [Semantic Versioning](http://semver.org/), but instead Google's version policy. As a result, jumps in major versions may not actually contain any backwards
40+
incompatible changes. Please read the release notes for such releases.
41+
3442

3543
## Online Demo
3644
An [online demo](http://giggsey.com/libphonenumber/) is available, and the source can be found at [giggsey/libphonenumber-example](https://github.com/giggsey/libphonenumber-example).
@@ -79,11 +87,13 @@ There are a few formats supported by the formatting method, as illustrated below
7987

8088
```php
8189
// Produces "+41446681800"
82-
echo $phoneUtil->format($swissNumberProto, PhoneNumberFormat::E164) . PHP_EOL;
90+
echo $phoneUtil->format($swissNumberProto, PhoneNumberFormat::E164);
91+
8392
// Produces "044 668 18 00"
84-
echo $phoneUtil->format($swissNumberProto, PhoneNumberFormat::NATIONAL) . PHP_EOL;
93+
echo $phoneUtil->format($swissNumberProto, PhoneNumberFormat::NATIONAL);
94+
8595
// Produces "+41 44 668 18 00"
86-
echo $phoneUtil->format($swissNumberProto, PhoneNumberFormat::INTERNATIONAL) . PHP_EOL;
96+
echo $phoneUtil->format($swissNumberProto, PhoneNumberFormat::INTERNATIONAL);
8797
```
8898

8999
You could also choose to format the number in the way it is dialled from another country:
@@ -110,24 +120,29 @@ $gbNumberProto = $phoneUtil->parse("0161 496 0000", "GB");
110120
$geocoder = \libphonenumber\geocoding\PhoneNumberOfflineGeocoder::getInstance();
111121

112122
// Outputs "Zurich"
113-
echo $geocoder->getDescriptionForNumber($swissNumberProto, "en_US") . PHP_EOL;
123+
echo $geocoder->getDescriptionForNumber($swissNumberProto, "en_US");
124+
114125
// Outputs "Zürich"
115-
echo $geocoder->getDescriptionForNumber($swissNumberProto, "de_DE") . PHP_EOL;
126+
echo $geocoder->getDescriptionForNumber($swissNumberProto, "de_DE");
127+
116128
// Outputs "Zurigo"
117-
echo $geocoder->getDescriptionForNumber($swissNumberProto, "it_IT") . PHP_EOL;
129+
echo $geocoder->getDescriptionForNumber($swissNumberProto, "it_IT");
118130

119131

120132
// Outputs "Mountain View, CA"
121-
echo $geocoder->getDescriptionForNumber($usNumberProto, "en_US") . PHP_EOL;
133+
echo $geocoder->getDescriptionForNumber($usNumberProto, "en_US");
134+
122135
// Outputs "Mountain View, CA"
123-
echo $geocoder->getDescriptionForNumber($usNumberProto, "de_DE") . PHP_EOL;
136+
echo $geocoder->getDescriptionForNumber($usNumberProto, "de_DE");
137+
124138
// Outputs "미국" (Korean for United States)
125-
echo $geocoder->getDescriptionForNumber($usNumberProto, "ko-KR") . PHP_EOL;
139+
echo $geocoder->getDescriptionForNumber($usNumberProto, "ko-KR");
126140

127141
// Outputs "Manchester"
128-
echo $geocoder->getDescriptionForNumber($gbNumberProto, "en_GB") . PHP_EOL;
142+
echo $geocoder->getDescriptionForNumber($gbNumberProto, "en_GB");
143+
129144
// Outputs "영국" (Korean for United Kingdom)
130-
echo $geocoder->getDescriptionForNumber($gbNumberProto, "ko-KR") . PHP_EOL;
145+
echo $geocoder->getDescriptionForNumber($gbNumberProto, "ko-KR");
131146
```
132147

133148
### ShortNumberInfo
@@ -137,18 +152,22 @@ $shortNumberInfo = \libphonenumber\ShortNumberInfo::getInstance();
137152

138153
// true
139154
var_dump($shortNumberInfo->isEmergencyNumber("999", "GB"));
155+
140156
// true
141157
var_dump($shortNumberInfo->connectsToEmergencyNumber("999", "GB"));
158+
142159
// false
143160
var_dump($shortNumberInfo->connectsToEmergencyNumber("911", "GB"));
144161

145162
// true
146163
var_dump($shortNumberInfo->isEmergencyNumber("911", "US"));
164+
147165
// true
148166
var_dump($shortNumberInfo->connectsToEmergencyNumber("911", "US"));
149167

150168
// false
151169
var_dump($shortNumberInfo->isEmergencyNumber("911123", "US"));
170+
152171
// true
153172
var_dump($shortNumberInfo->connectsToEmergencyNumber("911123", "US"));
154173
```
@@ -197,4 +216,4 @@ Other packages exist that integrate libphonenumber-for-php into frameworks.
197216
These packages are supplied by third parties, and their quality can not be guaranteed.
198217

199218
- Symfony: [PhoneNumberBundle](https://github.com/misd-service-development/phone-number-bundle)
200-
- Laravel: [Laravel Phone Validator](https://github.com/Propaganistas/laravel-phone)
219+

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "giggsey/libphonenumber-for-php",
33
"type": "library",
4-
"description": "Unofficial PHP Port of Google's libphonenumber",
4+
"description": "PHP Port of Google's libphonenumber",
55
"keywords": ["phonenumber", "libphonenumber", "mobile", "validation", "geocoding", "geolocation"],
66
"homepage": "https://github.com/giggsey/libphonenumber-for-php",
77
"license": "Apache-2.0",
@@ -45,7 +45,7 @@
4545
},
4646
"extra": {
4747
"branch-alias": {
48-
"dev-master": "6.x-dev"
48+
"dev-master": "7.x-dev"
4949
}
5050
}
5151
}

phpunit.xml.dist

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@
2525
</whitelist>
2626
</filter>
2727

28-
</phpunit>
28+
</phpunit>
29+

0 commit comments

Comments
 (0)