crazybooot / base64-validation
Laravel validators for base64 encoded files
Installs: 1 190 017
Dependents: 9
Suggesters: 0
Security: 0
Stars: 129
Watchers: 4
Forks: 33
Open Issues: 9
Requires
- php: ^7.1|^8.0
- laravel/framework: ^5.5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
README
Laravel validators for base64 encoded files, includes versions of laravel files validation for base64 encoded files.
Requirements
- PHP: 7.1+/8.0+
- Laravel: 5.5+/6+/7+/8+/9+/10+/11+
Install
- Install composer package to your laravel project
$ composer require crazybooot/base64-validation
Using
Use base64 validation rules as usual Laravel validation rules. Base64 rules variants supports all parameters from their original Laravel rules.
public function rules(): array { return [ 'attachment' => 'sometimes|base64dimensions:min_width=100,min_height=200', ]; }
Available rules
Localization
By default each base64 rule uses validation error message from its non base64 file rule equivalent, for example localization from 'validation.min.file' is used for base64min message. If you would like to have your own localization for base64 rules you can easy change default behaviour by publishing config
php artisan vendor:publish --provider="Crazybooot\Base64Validation\Providers\ServiceProvider" --tag=config
and setting up replace_validation_messages
option to false
on config/base64validation.php file,
and add localizations for rules in standard Laravel way.
License
The MIT License (MIT). Please see License File for more information.