aquinoaldair / phone-code

Country phone codes

Home Page:https://github.com/aquinoaldair/phone-code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Codigos o Prefijos de teléfonos de paises

Latest Version on Packagist Build Status Total Downloads

Laravel 5.8 or higher, 6.x, 7.x

Installation

You can install the package via composer:

composer require aquinoaldair/phone-code

Usage

Properties:

nombre, name, phone_code, iso2, iso3

use Aquinoaldair\PhoneCode\PhoneCode;


//PRINCIPAL FUNCTIONS


$phonecode = new PhoneCode();

$phonecode->make("2281694545")->fromName('Mexico'); // return "522281694545"
$phonecode->makeFull("2281694545")->fromName('Mexico'); // return "+522281694545"

$phonecode->make("2281694545")->fromIso2('MX'); // return "522281694545"
$phonecode->makeFull("2281694545")->fromIso2('MX'); // return "+522281694545" 

$phonecode->make("2281694545")->fromIso3('MEX'); // return "522281694545"
$phonecode->makeFull("2281694545")->fromIso3('mex'); // return "+522281694545" 

$phonecode->getAll(); // return all data as collection

//STATICS FUNCTIONS

PhoneCode::isCodeOf(51);   // "Peru"
PhoneCode::codeOf("Peru"); // "51"
$items = PhoneCode::get(); // return a collection

// Working with collections

$item  = $items->first();

$item->phone_code; // "93
$item->nombre; // "Afganistán"
$item->name; // "Afghanistan"
$item->iso2; // "AF"
$item->iso3; // "AFG" 


$items->firstWhere('name', "Peru");

/*
{
  "nombre": "Perú"
  "name": "Peru"
  "nom": "Pérou"
  "iso2": "PE"
  "iso3": "PER"
  "phone_code": "51"
}
*/

- You can implement any functionality of the laravel collections.
- See https://laravel.com/docs/7.x/collections

Configuration

php artisan vendor:publish --tag=config

This will publish all the configuration options to: config/phone-code.php. You can add new values.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email aquinoaldair@hotmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

About

Country phone codes

https://github.com/aquinoaldair/phone-code

License:MIT License


Languages

Language:PHP 100.0%