-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse doesn't allow country code to be blank #85
Comments
I just tried that, and it works fine require __DIR__ . '/vendor/autoload.php';
$phoneNumberUtil = \libphonenumber\PhoneNumberUtil::getInstance();
$phoneObj = $phoneNumberUtil->parse("+441174960000", '');
var_dump($phoneNumberUtil->isValidNumber($phoneObj));
var_dump($phoneNumberUtil->format($phoneObj, \libphonenumber\PhoneNumberFormat::E164)); Returns
That matches the Java API. The parameter is required, but can be The demo might not allow empty country names, but I could fix that if that's the issue you're having. |
@colouredFunk Are you still having this issue? |
No reply for 3 days, closing. If you are still having an issue, please reopen this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If supplying an international number to parse, the country code should be optional.
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
$number = $phoneUtil->parse($phone, "");
Example - http://libphonenumber.appspot.com/, enter a international number, leave step 2 and 3, it parse the number correctly and returns country code etc.
The text was updated successfully, but these errors were encountered: