1

Is it good idea to use Google libphonenumber library for commercial application? Eg. we are thinking to add validation of a phone number at the time of sign up. Earlier we were using regex for it. As we have OTP based verification system, so regex works good for us. And hence, we do not get any bad phone numbers in our system. Earlier, we were working only for single country numbers, so regex was easy. Now we are thinking to accept international numbers also. So, we found that google libphonenumber library does validate for any international number. https://github.com/googlei18n/libphonenumber

This seems a good option and also seems very accurate. But in this, we think there is 1 problem that when some numbers are open in some country, then we always need to update the version of library in our system also so that it will start accepting those numbers. We found that this open source library is also used by Whatsapp. https://www.whatsapp.com/opensource/?l=es

But how do they manage this problem of updating version every time? Also, is any other company which is also using it.

Can someone please suggest, what should we do? Should we use regex for international numbers or this library.

hatellla
  • 4,796
  • 8
  • 49
  • 101

1 Answers1

3

Yes, you can use googlelibphonenumber for comercial applications since it has an Apache 2.0 license (you can see details here).

And of course, you should be always updating the library.

But you always could lose some very new numbers, right?

Well, if you are very strict with that and never want to deal with a false negative numbers, you could use the isPossibleNumber function like you were using isValidNumber function. But that would open the possibility to have false positive numbers. So at the end is your decision but you can't be 100% accurate and updated. You just have to choose if it's better to have false positive numbers or false negative numbers. but don't worry too much about that, the possibility of both cases is very little.

Gepser Hoil
  • 3,998
  • 4
  • 24
  • 34