gupalo/ru-phone-parser

Russia Phone Parser

Installs: 242

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.0.1 2020-08-31 15:28 UTC

This package is auto-updated.

Last update: 2024-10-29 06:05:59 UTC


README

Detect region and phone type by phone number.

Install

composer require gupalo/ru-phone-parser

Use

$phone = RuPhone::create('3013042350');
print_r([
    'source' => $phone->getSource(), // '+7(301)304-23-50',
    'number' => $phone->getNumber(), // '3013042350',
    'code' => $phone->getCode(), // 301,
    'range_begin' => $phone->getRangeBegin(), // 3042300,
    'range_end' => $phone->getRangeEnd(), // 3042399,
    'capacity' => $phone->getCapacity(), // 100,
    'operator' => $phone->getOperator(), // 'ПАО "Ростелеком"',
    'city' => $phone->getCity(), // 'г. Северобайкальск',
    'region' => $phone->getRegion(), // 'Республика Бурятия',
]);
print_r($phone->jsonSerialize()); // same

Invalid and not found phones throw Exceptions. See tests.

Links