Giter VIP home page Giter VIP logo

base64-validation's Introduction

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.

base64-validation's People

Contributors

crazybooot avatar miraries avatar matiosfree avatar neoighodaro avatar laravel-shift avatar innoflash avatar keatliang2005 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.