pixelpeter / laravel5-isocodes-validation Goto Github PK
View Code? Open in Web Editor NEWLaravel 5 wrapper for the IsoCodes Validation library from ronanguilloux
License: Other
Laravel 5 wrapper for the IsoCodes Validation library from ronanguilloux
License: Other
Hi there, I was wondering if you're planning to support ZIP+4 in the package?
Currently, I have to omit the zipcode:country
rule, as a ZIP+4 results in an error like "The value "12345-1234" of zipcode is not valid for "USA"."
Just here as a reference:
https://en.wikipedia.org/wiki/ZIP_Code#ZIP+4
Thanks!
Validation rule example:
'shipments.*.from.zip' => 'zipcode:shipments.*.from.country_id'
Sources:
Can You add getExplicitKeys() and replaceAsterisksInParameters() like this?
public function validateZipcode($attribute, $value, $parameters)
{
$this->requireParameterCount(1, $parameters, 'zipcode');
// replace asterisk/wildcard '*' with $attribute index, example: 'shipments.*.from.country_id' -> shipments.0.from.country_id' ($this->currentRule)
if ($keys = $this->getExplicitKeys($attribute)) {
$parameters = $this->replaceAsterisksInParameters($parameters, $keys);
}
$country = Arr::get($this->data, $parameters[0], $parameters[0]);
return $this->runIsoCodesValidator(\IsoCodes\ZipCode::class, $value, $country);
}
snake_case
has been removed in laravel 5.9
I can confirm that this lib does not work with laravel 6.0
https://github.com/laravel/framework/pull/26898/files#diff-887b2fccb767c2cdab0e4d6964d55b13R830
Just installed v2.0.0, but Auto-Discovery is not working. I think you need something like this in your composer.json:
"extra": {
"laravel": {
"providers": [
"Pixelpeter\\IsoCodesValidation\\IsoCodesValidationServiceProvider"
]
}
}
@pixelpeter FYI we published an updated version of the package, which should work with versions of Laravel >=5, though restricted to PHP 7.4+
We'd be happy to submit a PR to update the package, if you're interested/willing to merge those few changes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.