Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 890 Bytes

README-quickstart.md

File metadata and controls

41 lines (29 loc) · 890 Bytes

Quick Start

  1. Add package to composer
{
  "require": {
    "tinned-software/PHP-libphono": "*"
  }
}
  1. run composer install

Example Code

require_once 'vendor/autoload.php';

$path = dirname(__FILE__) . '/resources/Country_Information.sqlite3';

$obj = new \Tinned\Libphono\PhoneNumber(
    new \Tinned\Libphono\DataProvider\ArrayDataProvider()
);

$sqlProvider = new \Tinned\Libphono\DataProvider\SQLiteDataProvider($path);
$obj = new \Tinned\Libphono\PhoneNumber(
    $sqlProvider
);

$res = $sqlProvider->fetchDataForISOCode('US', \Tinned\Libphono\PhoneNumber::INPUT_ISO_3166_ALPHA2);

var_dump($res);

$service = new \Tinned\Libphono\Service\LibphonoService(
    $sqlProvider
);

$phoneObj = $service->getPhoneNumber('06801111111', 'AUT', \Tinned\Libphono\PhoneNumber::INPUT_ISO_3166_ALPHA3);

print_r($phoneObj->getNormalizedInternationalNumber());