Validation rules for Money and Currency
brokeyourbike/money-validation-laravel is a Laravel package for validation rules for money and currency.
It currently has 1 GitHub stars and 2.836 downloads on Packagist (latest version 1.0.2).
Install it with composer require brokeyourbike/money-validation-laravel.
Discover more Laravel packages by brokeyourbike
or browse all Laravel packages to compare alternatives.
Last updated
Validation rules for Money and Currency
composer require brokeyourbike/money-validation-laravel
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(),
],
];
}
}