Coder Social home page Coder Social logo

phonenumber's Issues

Can't catch exception

Hi,

I'm having trouble catching the exceptions using the following code.

try {
      $numberParsed = PhoneNumber::parse('+333', $region);
      $numberValid = PhoneNumber::parse('+333', $region)->isValidNumber();
		    
}catch (PhoneNumberParseException $e) {
      // 'The string supplied is too short to be a phone number.'
      error_log($e);
}

Throws the error

PHP Fatal error:  Uncaught libphonenumber\NumberParseException: The string supplied is too short to be a phone number. in /www/zendsvr6/htdocs/ridgwad/stream_dev_1/core/utils/composer/vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php:1650
Stack trace:
#0 /www/zendsvr6/htdocs/ridgwad/stream_dev_1/core/utils/composer/vendor/giggsey/libphonenumber-for-php/src/PhoneNumberUtil.php(3023): libphonenumber\PhoneNumberUtil->parseHelper('+333', 'GB', false, true, Object(libphonenumber\PhoneNumber))

Any ideas what I'm doing wrong?

Syntax error in src/PhoneNumber.php

Hello,

Just wanted to warn you there is a syntax error on line 106 in the file.
A "?" symbol is making all crash.

Btw thanks for the plugin !
Cheers,
Thomas

Any plans to add geolocation?

Hi

I would like to use brick phoneumber, but it's missing geolocation features.
Are there any plans to add this in future releases?

Thanks

Netherlands Antilles Country Code: Missing or invalid default region

Hello!

When trying to parse phone numbers of the format 599 XXXX XXXX with country code AN, parse() raises a PhoneNumberParseException with the message Missing or invalid default region..

e.g.

try {
   $number = PhoneNumber::parse('59912345678', 'AN');
   echo $number->format(PhoneNumberFormat::E164);
} catch (PhoneNumberParseException $e) {
   echo $e->getMessage();
}

Netherlands Antilles was dissolved in 2010 - is this why phone numbers from this country are not supported by parse()?

The Netherlands Antilles Alpha-2 code was 'AN', and the Alpha-2 codes of most other countries seem to work with parse().

The country calling code of Netherlands Antilles was 599, and it is now in use in Curaçao and the Caribbean Netherlands.

My company has a lot of legacy customers whose phone numbers begin with 599 and whose country codes are AN. It would really help us out if AN was supported by parse().

Thanks for your time and maintaining this package 😄

PhoneNumber::getGeographicalAreaCode().

many thanks, that helps
what i was after if you
$phoneNumber = PhoneNumber::parse('02079460585');
echo $phoneNumber->getGeographicalAreaCode(); // 20
echo $phoneNumber->getGeographicalAreaCodeLocation(); // London

$phoneNumber = PhoneNumber::parse('01993123452');
echo $phoneNumber->getGeographicalAreaCode(); // 01993
echo $phoneNumber->getGeographicalAreaCodeLocation(); // Witney

$phoneNumber = PhoneNumber::parse('0901254265');
echo $phoneNumber->getGeographicalAreaCode(); // 09
echo $phoneNumber->getGeographicalAreaCodeLocation(); // NGN
echo $phoneNumber->getNumberType(); // premium rate

basically trying to phase everything from
https://www.ofcom.org.uk/phones-telecoms-and-internet/advice-for-consumers/advice/telephone-area-codes-tool

many thanks

Getting error for Brazil Number

Array
(
[error] => No valid contact for +5575*******

)

I got this error when I tried searching this number. On some online searched I found that it's from Brazil but it's giving error here.

[Bugfix] - Zero prefix

Hi guys
There is a particularly problematic bug in the parse functionality.
The function remove the zero numbers from the prefix.
Eg: 00391234567 --> 391234567
This is not a good behavior because in some countries the zero numbers in prefix are integral part of the phone number.
There is a way to fix this?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.