Skip to content
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

Implement ISO4217 currency validation rule #48

Merged
merged 4 commits into from
Aug 6, 2021
Merged

Implement ISO4217 currency validation rule #48

merged 4 commits into from
Aug 6, 2021

Conversation

bilfeldt
Copy link
Contributor

@bilfeldt bilfeldt commented Aug 4, 2021

This PR adds a new validation rule for validating ISO4217 currencies using their most common form which is a three letter code (examples: USD, EUR, CNY).

  • Implement validation rule Currency()
  • Add tests
  • Add README.md description

This implementation intentionally uses the alcohol/iso4217 package for ISO4217 checks (the more downloaded package Payum/iso4217 is a fork of this one and has been abandoned).

Note that an alternative could be to rely on the already required package league/iso3166 which includes currency codes (see src/ISO3166.php@L2431), but I was not able to confirm if this list is in fact complete.

UPDATE: has been changed to league/iso3166

Copy link
Member

@freekmurze freekmurze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this. Let's improve it a bit so people not using this rule, won't have to pull in an extra package.

composer.json Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
@freekmurze freekmurze merged commit 241fe60 into spatie:master Aug 6, 2021
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants