Merge remote-tracking branch 'refs/remotes/origin/master' into arindam-bug-priority
This commit is contained in:
63
vendor/propaganistas/laravel-phone/README.md
vendored
63
vendor/propaganistas/laravel-phone/README.md
vendored
@@ -7,49 +7,40 @@
|
||||
[](https://packagist.org/packages/propaganistas/laravel-phone)
|
||||
[](https://packagist.org/packages/propaganistas/laravel-phone)
|
||||
|
||||
Adds a phone validator to Laravel 4 and 5 based on the [PHP port](https://github.com/giggsey/libphonenumber-for-php) of [Google's libphonenumber API](https://github.com/googlei18n/libphonenumber) by [giggsey](https://github.com/giggsey).
|
||||
Adds a phone validator to Laravel 4|5 and Lumen based on the [PHP port](https://github.com/giggsey/libphonenumber-for-php) of [Google's libphonenumber API](https://github.com/googlei18n/libphonenumber) by [giggsey](https://github.com/giggsey).
|
||||
|
||||
### Installation
|
||||
|
||||
1. In the `require` key of `composer.json` file add the following
|
||||
Run the following command to install the latest version of the package
|
||||
|
||||
```json
|
||||
"propaganistas/laravel-phone": "~2.0"
|
||||
```
|
||||
```bash
|
||||
composer require propaganistas/laravel-phone
|
||||
```
|
||||
|
||||
2. Run the Composer update command
|
||||
**Laravel**
|
||||
|
||||
```bash
|
||||
composer update
|
||||
```
|
||||
In your app config, add the Service Provider to the `$providers` array
|
||||
|
||||
3. In your app config, add the Service Provider to the end of the `$providers` array
|
||||
```php
|
||||
'providers' => [
|
||||
...
|
||||
Propaganistas\LaravelPhone\LaravelPhoneServiceProvider::class,
|
||||
],
|
||||
```
|
||||
|
||||
**Laravel 5**
|
||||
```php
|
||||
'providers' => [
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
...
|
||||
Propaganistas\LaravelPhone\LaravelPhoneServiceProvider::class,
|
||||
],
|
||||
```
|
||||
|
||||
**Laravel 4**
|
||||
```php
|
||||
'providers' => [
|
||||
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
|
||||
'Illuminate\Auth\AuthServiceProvider',
|
||||
...
|
||||
'Propaganistas\LaravelPhone\LaravelPhoneServiceProvider',
|
||||
],
|
||||
```
|
||||
In your languages directory, add for each language an extra language line for the validator:
|
||||
|
||||
4. In your languages directory, add for each language an extra language line for the validator:
|
||||
|
||||
```php
|
||||
```php
|
||||
"phone" => "The :attribute field contains an invalid number.",
|
||||
```
|
||||
```
|
||||
|
||||
**Lumen**
|
||||
|
||||
In `bootstrap/app.php`, register the Service Provider
|
||||
|
||||
```php
|
||||
$app->register(Propaganistas\LaravelPhone\LaravelPhoneServiceProvider::class);
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
@@ -102,11 +93,11 @@ You can also enable more lenient validation (for example, fixed lines without ar
|
||||
'phonefield' => 'phone:LENIENT,US',
|
||||
```
|
||||
|
||||
### Display
|
||||
Format a fetched phone value using the helper function. `$country_code` is the country the phone number belongs to.
|
||||
### Helper function
|
||||
Format a fetched phone value using the `phone()` helper function. `$country_code` is the country the phone number belongs to.
|
||||
|
||||
```php
|
||||
phone_format($phone_number, $country_code = null, $format = PhoneNumberFormat::INTERNATIONAL)
|
||||
phone($phone_number, $country_code = null, $format = PhoneNumberFormat::INTERNATIONAL)
|
||||
```
|
||||
If no `$country_code` was given, the current application locale will be used as default.
|
||||
The `$format` parameter is optional and should be a constant of `libphonenumber\PhoneNumberFormat` (defaults to `libphonenumber\PhoneNumberFormat::INTERNATIONAL`)
|
||||
|
||||
Reference in New Issue
Block a user