-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
Use libphonenumber-for-php-lite instead of libphonenumber-for-php #248
Use libphonenumber-for-php-lite instead of libphonenumber-for-php #248
Conversation
Thank you - I wasn't aware of the lite version yet. I'd rather have this package handle null values properly instead of completely removing support for it. Could you look into that? |
The thing is that So the only alternative solution to not supporting null values anymore would be to handle public function __construct(?string $number, $country = [])
{
$this->number = is_null($number) ? '': $number;
$this->countries = Arr::wrap($country);
} In this case the Would that be an acceptable approach? |
Looks great. I tend to preserve it like this because empty form input gets converted to null values. Applications might blow up if the phone helper suddenly doesn't support null anymore. |
Updated! |
Adjusting minimum version to |
I'm wondering: what if someone actually listed the original
I think |
I don't see any technical solution to that problem apart from indeed using this |
Created upstream PRs for that: giggsey/libphonenumber-for-php#625 |
8.13.35 is now released that should cover this for you |
Thanks for the heads-up! Merging this now. |
This was a breaking change. I updated to the latest version of this package and suddenly some tests were failing because the code was using features that are not available in the lite version |
It should not be breaking in any way for functionality provided by the package itself. Only in case of a self-defined macro you might have introduced additional features. But as soon as you do that, i.e. directly using features of libphonenumber, you should have listed libphonenumber as a direct project dependency because you're relying on that package in your own code. If libphonenumber was listed, everything should keep working properly because lite is configured to be superseded by libphonenumber whenever already present. |
@gdebrauwer I'd recommend adding something like Composer Require Checker to your CICD. It tells you if you have any indirect dependencies within your project. |
This change allows to use
giggsey/libphonenumber-for-php-lite
instead ofgiggsey/libphonenumber-for-php
.giggsey/libphonenumber-for-php-lite
is only 1.6MB in comparison with 19MB forgiggsey/libphonenumber-for-php
, allowing for a much smaller package size.The main caveat is that only version 8.x of the library can be used, since the lite variant was created based on version 8 of the original library.
It is also not possible to passnull
as a phone number with the lite version, hence the test that I removed.