https://github.com/brokeyourbike/country-validation-laravel
Laravel country validation rules
https://github.com/brokeyourbike/country-validation-laravel
hacktoberfest laravel laravel-8 laravel-8-package laravel-package php php8 validation
Last synced: 3 months ago
JSON representation
Laravel country validation rules
- Host: GitHub
- URL: https://github.com/brokeyourbike/country-validation-laravel
- Owner: brokeyourbike
- License: mpl-2.0
- Created: 2021-12-21T17:34:00.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-20T11:35:35.000Z (almost 2 years ago)
- Last Synced: 2024-12-25T09:18:29.779Z (4 months ago)
- Topics: hacktoberfest, laravel, laravel-8, laravel-8-package, laravel-package, php, php8, validation
- Language: PHP
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# country-validation-laravel
[](https://github.com/brokeyourbike/country-validation-laravel/releases)
[](https://packagist.org/packages/brokeyourbike/country-validation-laravel)
[](https://codeclimate.com/github/brokeyourbike/country-validation-laravel/maintainability)
[](https://codeclimate.com/github/brokeyourbike/country-validation-laravel/test_coverage)Laravel country validation rules
## Installation
```bash
composer require brokeyourbike/country-validation-laravel
```## Usage
```php
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](https://github.com/brokeyourbike) | [Twitter](https://twitter.com/brokeyourbike) | [LinkedIn](https://www.linkedin.com/in/brokeyourbike) | [stasi.uk](https://stasi.uk)## License
[Mozilla Public License v2.0](https://github.com/brokeyourbike/country-validation-laravel/blob/main/LICENSE)