Laravel validators for base64 encoded images.
- PHP: 7.1+
- Laravel: 5.5+
- Install composer package to your laravel application
$ composer require harishpatel143/laravel-base64-validation
Use base64 image validation rule as usual Laravel validation rules. Base64 rule variants supports all parameters from their original Laravel rules.
public function rules(): array
{
return [
'avatar' => 'base64image',
];
}
protected function validator(array $data)
{
return Validator::make($data, [
'avatar' => ['base64image'],
]);
}