brokeyourbike/money-validation-laravel
Validation rules for Money and Currency
2,850
1
| Install | |
|---|---|
composer require brokeyourbike/money-validation-laravel |
|
| Latest Version: | 1.0.2 |
| PHP: | ^8.0 |
| Laravel: | 8 · 9 |
| License: | MPL-2.0 |
| Last Updated: | May 20, 2023 |
| Links: | GitHub · Packagist |
Maintainer: brokeyourbike
money-validation-laravel
Validation rules for Money and Currency
Installation
composer require brokeyourbike/money-validation-laravel
Usage
Package uses service container for currencies resolution. You can set it in your AppServiceProvider
use Money\Currencies\ISOCurrencies;
use Money\Currencies;
public function register()
{
$this->app->singleton(Currencies::class, function () {
return new ISOCurrencies();
});
}
use Illuminate\Foundation\Http\FormRequest;
use BrokeYourBike\MoneyValidation\IsValidCurrency;
class ExampleRequest extends FormRequest
{
public function rules()
{
return [
'currency_code' => [
'required',
'string',
'size:3',
new IsValidCurrency(),
],
];
}
}
Authors
- Ivan Stasiuk | Twitter | LinkedIn | stasi.uk
License
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
651,963,193
9,701
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
435,097,283
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
407,699,310
4,663
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0.2 | ^8.0 | ^8| | MPL-2.0 | |
| 1.0.1 | ^8.0 | ^8| | MPL-2.0 | |
| 1.0.0 | ^7.4 || | ^8 | MPL-2.0 |