百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

laravel-validate

> 后端框架
开源

Laravel-Validate 包通过自定义规则和方法来增强 Laravel 的验证功能,实现简化且高效的验证逻辑

594 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Laravel-Validate 包通过自定义规则和方法来增强 Laravel 的验证功能,实现简化且高效的验证逻辑

Laravel Validate

Introduction


The Laravel-Validate package enhanced Laravel validation capabilities with custom rules and methods for simplified and efficient validation logic.

You can validate data more easily. The Laravel Validate has lots of rule classes for validation.

This package supports localization and can be used for most languages.

(If some language didn't support, you can create PR for new language or write custom for yourself)

AI Documentation

Requirements


  • PHP >= 8.0
  • Laravel >= 9.0
GitHub L6 L7 L8 L9 L10 L11 L12 L13
1.5 :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x: :x: :x:
1.6 :x: :x: :x: :white_check_mark: :white_check_mark: :x: :x: :x:
1.7 :x: :x: :x: :white_check_mark: :white_check_mark: :x: :x: :x:
1.8 :x: :x: :x: :white_check_mark: :white_check_mark: :white_check_mark: :x: :x:
1.9 :x: :x: :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x:
2.0 :x: :x: :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:

Installation

You can install the package with Composer.

bash
composer require milwad/laravel-validate

Publish

If you want to publish a config file, you can run the following command on your terminal:

bash
php artisan vendor:publish --tag="laravel-validate-config"

If you want to publish a lang file for a custom validation message, you can run this command in the terminal:

bash
php artisan vendor:publish --tag="validate-lang-{$lang}"

You can replace $lang with your language name, for example:

bash
php artisan vendor:publish --tag="validate-lang-en"

You can see the Support Languages section if you don't know the language's name.

Configurations

If you may use rules with a string like ValidPhone, you need to change the config option to true:

php
/*
 * If you want to use rules like 'required|ValidPhone' in your validations, you can change it to true.
 */
'using_container' => false,

If using_container is set to true, you might have rules like this:

php
'phone_number' => 'required|ValidPhone',

And ValidPhone would be a class that is resolved via the service container to check the validity of the phone number.

Usage

You can use Laravel-Validate Rules very simply. You can use the new keyword before the rule name.

php
use Milwad\LaravelValidate\Rules\ValidPhoneNumber;

return [
    'phone' => ['required', new ValidPhoneNumber()],
];

Rules

# Rule name Usage
1 ValidBase64 Validate base64 for ex (bWlsd2Fk)
2 ValidBitcoinAddress Validate bitcoin address for ex (1KFHE7w8BhaENAswwryaoccDb6qcT6DbYY)
3 ValidCamelCase Validate camel case for ex (milwadDev)
4 ValidCapitalCharWithNumber Validate string for ex (MILWAD-84)
5 ValidCarNumber Validate car number for ex (KA01AB1234)
6 ValidCartNumberIran Validate card number for ex (1234123412341234)
7 ValidCountry Validate country name for ex (United Arab Emirates)
8 ValidCreditCard Validate credit card for ex (4111111111111111)
9 ValidDiscordUsername Validate Discord username for ex (Milwad#2134)
10 ValidDomain Validate domain name for ex (github.com)
11 ValidDuplicate Validate duplicate string/number for ex (1123456)
12 ValidDuplicateCharacter Validate duplicate characters for ex (1,2,3,4,5,6,7,8,9)
13 ValidEvenNumber Validate number is even for ex (1024)
14 ValidHashtag Validate hashtag for ex (#milwad)
15 ValidHexColor Validate hex color for ex (#fcba03)
16 ValidHtmlTag Validate HTML tags for ex (

) | | 17 | ValidIban | Validate IBAN for ex (IR062960000000100324200001) | | 18 | ValidImei | Validate IMEI phone for ex (354809104295874) | | 19 | ValidIpAddressIPV4 | Validate IPv4 address for ex (129.144.50.56) | | 20 | ValidIpAddressIPV6 | Validate IPv6 address for ex (2001:db8:3333:4444:5555:6666:7777:8888) | | 21 | ValidIranPostalCode | Validate Iran postal code for ex (3354355599) | | 22 | ValidJalaliDate | Validate Jalali date for ex (1384/8/25) | | 23 | ValidJwt | Validate JWT token | | 24 | ValidKebabCase | Validate kebab case for ex (milwad-dev) | | 25 | ValidLandlineNumber | Validate landline number | | 26 | ValidLatitude | Validate latitude for ex (50.1109) | | 27 | ValidLongitude | Validate longitude for ex (51.377225156511855) | | 28 | ValidNameDaysWeek | Validate day of week (monday) | | 29 | ValidNationalCard | Validate national card for ex (015016437) | | 30 | ValidNoHtml | Validate string without HTML | | 31 | ValidOddNumber | Validate number is odd for ex (4321) | | 32 | ValidPascalCase | Validate PascalCase for ex (MilwadDev) | | 33 | ValidPattern | Validate custom pattern | | 34 | ValidPhoneNumber | Validate phone number for ex (09366000000) | | 35 | ValidPort | Validate port value for ex (8080) | | 36 | ValidSlashEndOfString | Validate string ending with slash (milwad/) | | 37 | ValidSlug | Validate slug for ex (milwad-dev) | | 38 | ValidSnakeCase | Validate snake_case for ex (milwad_dev) | | 39 | [ValidStrongPassword](https://github.com/milwad-dev/laravel-validate/blob/1.x/docs/1.x/valid-strong-p

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPadvance-validationlarave-packagelaravellaravel-eloquent-validation

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架