PHPackages                             zodream/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. zodream/validate

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

zodream/validate
================

form validate,model validate

5.3(2y ago)0164↓100%1MITPHPPHP &gt;=8.2

Since Feb 10Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/zodream/validate)[ Packagist](https://packagist.org/packages/zodream/validate)[ Docs](https://github.com/zodream/validate)[ RSS](/packages/zodream-validate/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (8)Dependencies (2)Versions (9)Used By (1)

validate
========

[](#validate)

表单数据验证器

使用方法
----

[](#使用方法)

自定义使用

```
Validator::make([
    'name' => 'required',
    'name' => ['required', 'message' => '用户名必填']
    [['name', 'url'], 'required', 'max' => 5],
    'name' => 'required|string|min:5|message:用户名长度必须大于5个字符'
])->validate($data);  // bool

Validator::make([
    'name' => 'required',
], $data); // 简写 bool

Validator::required()->valdate($value); // bool

$v = Validator::make([]);
$v->validate(); // bool
$v->errors();    // ['name' => ['错误信息']]
$v->firstError(); // '错误信息'
```

配合 Model 使用

```
class Do extends Model {
    public function rules() {
        return [
            'name' => 'required',   // 一行只能验证一个属性
            'url' => 'required|url|max:255'
        ];
    }

    public function messages() {
        return [
            'required' => ':attribute 必填',
            'name.required' => '用户名必填！',
        ];
    }

    public function labels() {
        return [
            'name' => '用户名'
        ];
    }

}
```

获取验证过的 提交字段

```
app('request')->validate([
    'name' => 'required'
]); // ['name' => '值']
```

验证方法
----

[](#验证方法)

required 必填

```
Validator::required()->validate('1'); // true
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance49

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% 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 ~319 days

Recently: every ~417 days

Total

8

Last Release

780d ago

Major Versions

1.2 → 2.02019-08-31

2.0 → 4.02020-10-02

4.0 → 5.02021-03-10

PHP version history (5 changes)v1.0PHP &gt;=5.6.0

4.0PHP &gt;=7.0.0

5.0PHP &gt;=8.0

5.2PHP &gt;=8.1

5.3PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![zx648383079](https://avatars.githubusercontent.com/u/9996852?v=4)](https://github.com/zx648383079 "zx648383079 (37 commits)")

---

Tags

validatezodream

### Embed Badge

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

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

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[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)[inhere/php-validate

generic data validate, filter library of the php

26787.4k13](/packages/inhere-php-validate)[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)[abcaeffchen/sepa-utilities

SepaUtilities provides useful methods for validating and sanitizing inputs used in SEPA files supporting PHP &gt;= 8.1.

312.0M2](/packages/abcaeffchen-sepa-utilities)[awurth/slim-validation

A wrapper around the respect/validation PHP validation library for easier error handling and display

65378.4k9](/packages/awurth-slim-validation)

PHPackages © 2026

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