brokeyourbike / country-validation-laravel
Laravel country validation rules
Fund package maintenance!
brokeyourbike
Open Collective
Requires
- php: ^8.0
- illuminate/contracts: ^8|^9
- league/iso3166: ^4.0
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.4
- orchestra/testbench: ^6.21
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-20 14:20:11 UTC
README
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