Download the PHP package f9webltd/laravel-validation-rules without Composer
On this page you can find all versions of the php package f9webltd/laravel-validation-rules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download f9webltd/laravel-validation-rules
More information about f9webltd/laravel-validation-rules
Files in f9webltd/laravel-validation-rules
Package laravel-validation-rules
Short Description A collection of useful Laravel validation rules
License MIT
Homepage https://github.com/f9webltd/laravel-validation-rules
Informations about the package laravel-validation-rules
Useful Laravel Validation Rules
A collection of useful Laravel validation rules.
Requirements
PHP >= 7.2, Laravel >=5.8 | 6.x | 7.x | 8.x
.
Installation
To publish the package validation message translations:
Published translations are available at resources/lang/vendor/f9web-validation-rules/messages.php
.
Usage
As discussed in the official Laravel documentation, import the required rule whenever required:
Alternatively use the rule directly with a Laravel form request object
Available rules
Base64EncodedString
Coordinate
DomainRestrictedEmail
ExcludesHtml
HexColourCode
Honorific
IncludesHtml
NoWhitespace
NumberParity
StringContains
StrongPassword
TitleCase
UKMobilePhone
Uppercase
Base64EncodedString
Ensure the passed attribute is a valid base 64 encoded string.
Coordinate
Ensure the passed attribute is a valid comma separated Latitude and Longitude string. For example: 51.507877,-0.087732
.
DomainRestrictedEmail
Ensure the passed email in question is part of the provided whitelist of domains.
For instance, to ensure the given email domain is f9web.co.uk
or laravel.com
:
The validation message will include the list of whitelisted domains based upon the provided configuration.
ExcludesHtml
Ensure the passed attribute does not contain HTML.
HexColourCode
Ensure the passed attribute is a valid hex colour code (three of six characters in length), optionally validating the presence of the #
prefix.
Minimum usage example to validate a short length code with the prefix i.e. #fff
:
Extended usage example to validate a long length code , omitting prefix i.e. cc0000
:
Honorific
Ensure the passed attribute is a valid honorific, omitting appended dots. The list of valid honorifics is available here.
IncludesHtml
Ensure the passed attribute contains HTML.
NoWhitespace
Ensure the passed attribute contains no whitespace.
NumberParity
Validate the number parity.
An odd number:
An even number:
StringContains
Ensure the given attribute contains the provided strings.
Minimum usage example to ensure the attribute in question contains the string php
or laravel
:
Optionally force the string to contain all provided phrases:
The validation message will include the list phrases based upon the provided configuration.
StrongPassword
Ensure the given attribute matches the provided conditions.
Minimum usage example to ensure the attribute:
- is a minimum of eight characters in length
- contains upper and lowercase characters
- contains at least one number
Additional methods are available.
The default special characters are !@#$%^&*()\-_=+{};:,<."£~?|>
. Optionally the withSpecialCharacters()
method can be used to define a custom list.
TitleCase
Ensure the provided attribute is title case.
UKMobilePhone
Ensure the provided attribute is a valid UK mobile telephone number.
Uppercase
Ensure the provided attribute is entirely uppercase.
Contribution
Any ideas are welcome. Feel free to submit any issues or pull requests.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-validation-rules with dependencies
ext-mbstring Version *
illuminate/contracts Version 5.8.* || ^6.0 || ^7.0 || ^8.0
illuminate/support Version 5.8.* || ^6.0 || ^7.0 || ^8.0