brokeyourbike / country-validation-laravel
Laravel 国家验证规则
资助包维护!
brokeyourbike
Open Collective
0.1.2
2023-05-14 22:31 UTC
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 国家验证规则
安装
composer require brokeyourbike/country-validation-laravel
使用
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(), ], ]; } }
作者
- Ivan Stasiuk | Twitter | LinkedIn | stasi.uk