PHPackages                             mouyong/validate - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. mouyong/validate

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

mouyong/validate
================

Based on illuminate/validate, validate is used outside the laravel framework

v2.0.4(3y ago)44212[1 issues](https://github.com/mouyong/validate/issues)MITPHP

Since Mar 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mouyong/validate)[ Packagist](https://packagist.org/packages/mouyong/validate)[ RSS](/packages/mouyong-validate/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (4)Dependencies (1)Versions (8)Used By (0)

在 laravel 框架外使用 laravel 的 validate
==================================

[](#在-laravel-框架外使用-laravel-的-validate)

安装
--

[](#安装)

`composer require mouyong/validate -vvv`

文件翻译创建
------

[](#文件翻译创建)

```
./webman plugin:install mouyong/validate

or

php ./vendor/mouyong/validate/src/scripts/install.php
```

### 移除翻译文件

[](#移除翻译文件)

```
./webman plugin:uninstall mouyong/validate

or

php ./vendor/mouyong/validate/src/scripts/uninstall.php
```

基础用法
----

[](#基础用法)

```
$data = [
    'name'  => 'Tinywan',
    'age'  => 24,
    'email' => 'Tinywan@163.com'
];

/** @var \Illuminate\Contracts\Validation\Validator|\Illuminate\Contracts\Validation\Factory $validator */
$validator = validator($data, [
    'name'  => 'require|max:25',
    'age'   => 'require|number|between:1,120',
    'email' => 'require|email'
], [
    'name.require' => '名称必须',
    'name.max'     => '名称最多不能超过25个字符',
    'age.require'   => '年龄必须是数字',
    'age.number'   => '年龄必须是数字',
    'age.between'  => '年龄只能在1-120之间',
    'email.require'        => '邮箱必须是数字',
    'email.email'        => '邮箱格式错误'
]);

$validator->validate();

// 或者直接简写
validator()->validate($data, [
    'name'  => 'require|max:25',
    'age'   => 'require|number|between:1,120',
    'email' => 'require|email'
], [
    'name.require' => '名称必须',
    'name.max'     => '名称最多不能超过25个字符',
    'age.require'   => '年龄必须是数字',
    'age.number'   => '年龄必须是数字',
    'age.between'  => '年龄只能在1-120之间',
    'email.require'        => '邮箱必须是数字',
    'email.email'        => '邮箱格式错误'
]);
```

更多验证规则请阅读：

参考
--

[](#参考)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~40 days

Recently: every ~59 days

Total

7

Last Release

1285d ago

Major Versions

v1.0.2 → v2.0.12022-04-30

### Community

Maintainers

![](https://www.gravatar.com/avatar/b37a4e4a059db2044bd4bc4336035e1d58fc4771d599b25bde0772e4a711f301?d=identicon)[mouyong](/maintainers/mouyong)

---

Top Contributors

[![mouyong](https://avatars.githubusercontent.com/u/10336437?v=4)](https://github.com/mouyong "mouyong (22 commits)")[![ifui](https://avatars.githubusercontent.com/u/46117570?v=4)](https://github.com/ifui "ifui (1 commits)")

---

Tags

validatorvalidatelaravel-validatewebmanmouyong validatewebman validate

### Embed Badge

![Health badge](/badges/mouyong-validate/health.svg)

```
[![Health](https://phpackages.com/badges/mouyong-validate/health.svg)](https://phpackages.com/packages/mouyong-validate)
```

###  Alternatives

[intervention/validation

Additional validation rules for the Laravel framework

6826.7M8](/packages/intervention-validation)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[wixel/gump

A fast, extensible &amp; stand-alone PHP input validation class that allows you to validate any data.

1.2k1.3M30](/packages/wixel-gump)[sunspikes/clamav-validator

Custom Laravel 5 anti-virus validator for file uploads.

3651.8M3](/packages/sunspikes-clamav-validator)[laravel-validation-rules/credit-card

Validate credit card number, expiration date, cvc

2412.2M5](/packages/laravel-validation-rules-credit-card)[sadegh19b/laravel-persian-validation

A comprehensive Laravel validation package for Persian text, numbers, dates, and Iranian national identifiers

18293.8k1](/packages/sadegh19b-laravel-persian-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
