country-validation-laravel maintained by brokeyourbike
Description
Laravel country validation rules
Author
Last update
2023/05/20 13:35
(dev-release-v0.1.3)
License
Downloads
548
country-validation-laravel
Laravel country validation rules
Installation
composer require brokeyourbike/country-validation-laravel
Usage
use Illuminate\Foundation\Http\FormRequest;
use BrokeYourBike\CountryValidation\IsValidCountryCodeAlpha2;
use BrokeYourBike\CountryValidation\IsValidCountryCodeAlpha3;
class ExampleRequest extends FormRequest
{
public function rules()
{
return [
'country_alpha2' => [
'required',
'string',
'size:2',
new IsValidCountryCodeAlpha2(),
],
'country_alpha3' => [
'required',
'string',
'size:3',
new IsValidCountryCodeAlpha3(),
],
];
}
}
Authors
- Ivan Stasiuk | Twitter | LinkedIn | stasi.uk