Respect / Validation

The most awesome validation engine ever created for PHP
https://respect-validation.readthedocs.io
MIT License
5.79k stars 776 forks source link

sokil/php-isocodes dependency is both suggested and required #1340

Closed franksl closed 3 years ago

franksl commented 3 years ago

Hi, I noticed that sokil/php-isocodes is set in both the "suggest" and "require" fields in composer.json. That is a very big library causing the vendor directory to become very big, this is a problem where space is limited. I suggest to leave that as only suggested (sorry, no pun intended :-) ). Thanks, Frank

sawirricardo commented 3 years ago

I agree with @franksl . In my opinion, it's best to leave the sokil/php-isocodes as optional

NordicAT commented 3 years ago

+1 This blew up my project by 85 MB. :open_mouth: After finding the issue I did roll back to 2.1.0.

dhrrgn commented 3 years ago

We are also concerned with this.

We deploy our application as a lambda function, which limits the compressed package size to 50MB (unless you store it on s3). Installing Respect doubled our package size because of iso-codes.

We do not use the rules that require that package, so it is not ideal.

As noted in PR #1335 by @henriquemoody, removing this would be a breaking change, and thus need a major release. However, I would argue that adding a >80MB dependency is also a breaking change for some people (like us...it broke our deployment process).

franksl commented 3 years ago

If anyone is interested while waiting for a resolution for this or waiting for some free time to evaluate other libraries I added a script in composer.json in my packages to remove the sokil library from vendor:

{
....
"scripts": {
        "post-update-cmd": [
            "rm -rf vendor/sokil"
        ]
    }
}

Hope this helps, Frank

henriquemoody commented 3 years ago

That's a good fix for now, @franksl! The problem is that "sokil/php-isocodes" stored the translations for all languages inside itself. If you only need them in English you can add this to your composer.json file:

{
    "scripts": {
        "post-update-cmd": [
            "rm -rf vendor/sokil/php-isocodes/messages"
        ]
    }
}

With that, the validations for "CountryCode", "CurrencyCode", "LanguageCode", and "SubdivisionCode" will still work

henriquemoody commented 3 years ago

I'm sorry it took so long. I've removed "sokil/php-isocodes" as a dependency and it's available on version 2.2.3.

I will try to introduce a smarter way to implement this on the next version.

henriquemoody commented 3 years ago

Thanks for reporting! 🐼