Laravel validators for base64 encoded files

crazybooot/base64-validation image

crazybooot/base64-validation stats

Downloads
781.1K
Stars
116
Open Issues
8
Forks
35

View on GitHub →

Crazybooot Base64-validation 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+

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

base64 rule analog of Laravel rule
base64max max (for file)
base64min min (for file)
base64dimensions dimensions (for image)
base64file file
base64image image
base64mimetypes mimetypes
base64mimes mimes
base64between between (for file)
base64size size (for file)

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.

crazybooot photo

Laravel + VueJS developer

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Crazybooot Base64 Validation Related Articles

Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit