2017 © Pedro Peláez
 

library validation

Additional Validator Functions for the Laravel Framework

image

intervention/validation

Additional Validator Functions for the Laravel Framework

  • Wednesday, November 8, 2017
  • by olivervogel
  • Repository
  • 8 Watchers
  • 93 Stars
  • 152,062 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 25 Forks
  • 3 Open issues
  • 24 Versions
  • 12 % Grown

The README.md

Intervention Validation

Intervention Validation is an extension library for Laravel's own validation system. The package adds rules to validate data like IBAN, BIC, ISBN, creditcard numbers and more., (*1)

Latest Version Tests Monthly Downloads Support me on Ko-fi, (*2)

Installation

You can install this package quick and easy with Composer., (*3)

Require the package via Composer:, (*4)

$ composer require intervention/validation

Laravel integration

The Validation library is built to work with the Laravel Framework (>=10). It comes with a service provider, which will be discovered automatically and registers the validation rules into your installation. The package provides 30 additional validation rules including multi language error messages, which can be used like Laravel's own validation rules., (*5)

use Illuminate\Support\Facades\Validator;
use Intervention\Validation\Rules\Creditcard;
use Intervention\Validation\Rules\Hexadecimalcolor;
use Intervention\Validation\Rules\Username;

$validator = Validator::make($request->all(), [
    'color' => new Hexadecimalcolor([3, 6]), // pass rule as object
    'number' => ['required', 'creditcard'], // or pass rule as string
    'name' => 'required|min:3|max:20|username', // combining rules works as well
]);

Changing the error messages:

Add the corresponding key to /resources/lang/<language>/validation.php like this:, (*6)

// example
'iban' => 'Please enter IBAN number!',

Or add your custom messages directly to the validator like described in the docs., (*7)

Available Rules

The following validation rules are available with this package., (*8)

Austrian insurance Number (austrian social security number)

The field under validation must be an Austrian insurance number, (*9)

public Intervention\Validation\Rules\AustrianInsuranceNumber::__construct()

Base64 encoded string

The field under validation must be Base64 encoded., (*10)

public Intervention\Validation\Rules\Base64::__construct()

Business Identifier Code (BIC)

Checks for a valid Business Identifier Code (BIC)., (*11)

public Intervention\Validation\Rules\Bic::__construct()

Camel case string

The field under validation must be a formatted in Camel case., (*12)

public Intervention\Validation\Rules\Camelcase::__construct()

Classless Inter-Domain Routing (CIDR)

Check if the value is a Classless Inter-Domain Routing notation (CIDR)., (*13)

public Intervention\Validation\Rules\Cidr::__construct()

Creditcard Number

The field under validation must be a valid creditcard number., (*14)

public Intervention\Validation\Rules\Creditcard::__construct()

Data URI scheme

The field under validation must be a valid Data URI., (*15)

public Intervention\Validation\Rules\DataUri::__construct(?array $media_types = null)

Domain name

The field under validation must be a well formed domainname., (*16)

public Intervention\Validation\Rules\Domainname::__construct()

European Article Number (EAN)

Checks for a valid European Article Number., (*17)

public Intervention\Validation\Rules\Ean::__construct(array $lengths = [8, 13])

Parameters

length, (*18)

Optional integer length (8 or 13) to check only for EAN-8 or EAN-13., (*19)

Global Release Identifier (GRid)

The field under validation must be a Global Release Identifier., (*20)

public Intervention\Validation\Rules\Grid::__construct()

Global Trade Item Number (GTIN)

Checks for a valid Global Trade Item Number., (*21)

public Intervention\Validation\Rules\Gtin::__construct(array $lengths = [8, 12, 13, 14])

Parameters

length, (*22)

Optional array of allowed lengths to check only for certain types (GTIN-8, GTIN-12, GTIN-13 or GTIN-14)., (*23)

Hexadecimal color code

The field under validation must be a valid hexadecimal color code., (*24)

public Intervention\Validation\Rules\Hexadecimalcolor::__construct(array $lengths = [3, 4, 6, 8])

Parameters

length, (*25)

Optional length as integer to check only for shorthand (3 or 4 characters) or full hexadecimal (6 or 8 characters) form., (*26)

HSL Color

The field under validation must be a valid HSL color code., (*27)

public Intervention\Validation\Rules\Hslcolor::__construct()

HSV Color

The field under validation must be a valid HSV/HSB color code., (*28)

public Intervention\Validation\Rules\Hsvcolor::__construct()

Text without HTML

The field under validation must be free of any html code., (*29)

public Intervention\Validation\Rules\HtmlClean::__construct()

International Bank Account Number (IBAN)

Checks for a valid International Bank Account Number (IBAN)., (*30)

public Intervention\Validation\Rules\Iban::__construct()

International Mobile Equipment Identity (IMEI)

The field under validation must be a International Mobile Equipment Identity (IMEI)., (*31)

public Intervention\Validation\Rules\Imei::__construct()

International Standard Book Number (ISBN)

The field under validation must be a valid International Standard Book Number (ISBN)., (*32)

public Intervention\Validation\Rules\Isbn::__construct(array $lengths = [10, 13])

Parameters

length, (*33)

Optional length parameter as integer to check only for ISBN-10 or ISBN-13., (*34)

International Securities Identification Number (ISIN)

Checks for a valid International Securities Identification Number (ISIN)., (*35)

public Intervention\Validation\Rules\Isin::__construct()

International Standard Serial Number (ISSN)

Checks for a valid International Standard Serial Number (ISSN)., (*36)

public Intervention\Validation\Rules\Issn::__construct()

JSON Web Token (JWT)

The given value must be a in format of a JSON Web Token., (*37)

public Intervention\Validation\Rules\Jwt::__construct()

Kebab case string

The given value must be formatted in Kebab case., (*38)

public Intervention\Validation\Rules\Kebabcase::__construct()

Latitude

Checks for a valid geographic Latitude., (*39)

public Intervention\Validation\Rules\Latitude::__construct()

Longitude

Checks for a valid geographic Longitude., (*40)

public Intervention\Validation\Rules\Longitude::__construct()

LatLng

Checks for a valid geographic comma separated pair of a Latitude and a Longitude., (*41)

public Intervention\Validation\Rules\LatLng::__construct()

Lower case string

The given value must be all lower case letters., (*42)

public Intervention\Validation\Rules\Lowercase::__construct()

Luhn algorithm

The given value must verify against its included Luhn algorithm check digit., (*43)

public Intervention\Validation\Rules\Luhn::__construct()

Media (MIME) type

Checks for a valid Mime Type (Media type)., (*44)

public Intervention\Validation\Rules\MimeType::__construct()

Postal Code

The field under validation must be a postal code of the given country., (*45)

public Intervention\Validation\Rules\Postalcode::__construct(array $countrycodes = [])

Parameters

countrycode, (*46)

Country code in ISO-639-1 format., (*47)

Postal Code (static instantiation)

public static Intervention\Validation\Rules\Postalcode::countrycode(array $countrycodes): Postalcode

Parameters

countrycode, (*48)

Country code in ISO-639-1 format., (*49)

Postal Code (static instantiation with reference)

public static Intervention\Validation\Rules\Postalcode::reference(string $reference): Postalcode

Parameters

reference, (*50)

Reference key to get ISO-639-1 country code from other data in validator., (*51)

Semantic Version Number

The field under validation must be a valid version numbers using Semantic Versioning., (*52)

public Intervention\Validation\Rules\SemVer::__construct()

SEO-friendly short text (Slug)

The field under validation must be a user- and SEO-friendly short text., (*53)

public Intervention\Validation\Rules\Slug::__construct()

Snake case string

The field under validation must formatted as Snake case text., (*54)

public Intervention\Validation\Rules\Snakecase::__construct()

Title case string

The field under validation must formatted in Title case., (*55)

public Intervention\Validation\Rules\Titlecase::__construct()

Universally Unique Lexicographically Sortable Identifier (ULID)

The field under validation must be a valid Universally Unique Lexicographically Sortable Identifier., (*56)

public Intervention\Validation\Rules\Ulid::__construct()

Upper case string

The field under validation must be all upper case., (*57)

public Intervention\Validation\Rules\Uppercase::__construct()

Username

The field under validation must be a valid username. Consisting of alpha-numeric characters, underscores, minus and starting with a alphabetic character. Multiple underscore and minus chars are not allowed. Underscore and minus chars are not allowed at the beginning or end., (*58)

public Intervention\Validation\Rules\Username::__construct()

Development & Testing

With this package comes a Docker image to build a test suite container. To build this container you have to have Docker installed on your system. You can run all tests with this command., (*59)

$ docker-compose run --rm --build tests

Authors

This library is developed and maintained by Oliver Vogel, (*60)

Thanks to the community of contributors who have helped to improve this project., (*61)

License

Intervention Validation is licensed under the MIT License., (*62)

The Versions

08/11 2017

dev-master

9999999-dev

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel validator validation iban creditcard isbn bic isin

29/06 2017

1.2.0

1.2.0.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel validator validation iban creditcard isbn bic isin

29/06 2017

1.1.12

1.1.12.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel validator validation iban creditcard isbn bic isin

28/06 2017

1.1.11

1.1.11.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel validator validation iban creditcard isbn bic isin

19/12 2016

1.1.10

1.1.10.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel validator validation iban creditcard isbn bic isin

24/11 2016

1.1.9

1.1.9.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel validator validation iban creditcard isbn bic isin

24/11 2016

1.1.8

1.1.8.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel validator validation iban creditcard isbn bic isin

24/11 2016

1.1.7

1.1.7.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel validator validation iban creditcard isbn bic isin

13/09 2016

1.1.6

1.1.6.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation iban creditcard isbn bic isin

07/09 2016

1.1.5

1.1.5.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation iban creditcard isbn bic isin

21/05 2016

1.1.4

1.1.4.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation iban creditcard isbn bic isin

11/08 2015

1.1.3

1.1.3.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation iban creditcard isbn bic

29/07 2015

1.1.2

1.1.2.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation iban creditcard isbn bic

29/07 2015

1.1.1

1.1.1.0

Additional Validator Functions for the Laravel Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation iban creditcard isbn bic

29/01 2015

1.1.0

1.1.0.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

27/09 2014

1.0.8

1.0.8.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

20/09 2014

1.0.7

1.0.7.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

07/04 2014

1.0.6

1.0.6.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

07/04 2014

1.0.5

1.0.5.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

19/06 2013

1.0.4

1.0.4.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

08/06 2013

1.0.3

1.0.3.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

02/06 2013

1.0.2

1.0.2.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

29/05 2013

1.0.1

1.0.1.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation

30/01 2013

1.0.0

1.0.0.0

Additional Validator Functions for the Laravel 4 Framework

  Sources   Download

MIT

The Requires

 

laravel validator validation