PHPackages                             seffeng/rules - 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. seffeng/rules

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

seffeng/rules
=============

PHP Rules

v0.1.8(1y ago)02.6k↓100%1MITPHPPHP &gt;=5.6

Since Jul 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/seffeng/php-rules)[ Packagist](https://packagist.org/packages/seffeng/rules)[ Docs](https://github.com/seffeng/php-rules)[ RSS](/packages/seffeng-rules/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)DependenciesVersions (10)Used By (1)

Rules
-----

[](#rules)

### 安装

[](#安装)

```
# 安装
$ composer require seffeng/rules
```

### 目录说明

[](#目录说明)

```
├─src
│    IDNumber.php            身份证号
│    Password.php            密码
│    Phone.php               手机号

```

### 示例

[](#示例)

```
  use Seffeng\Rules\IDNumber;

  /**
   * Test.php
   * 方法验证示例
   */
  public function test()
  {
      $rule = new IDNumber();
      // 严格模式，验证所属地
      $rule->setIsStrict(true);
      // 是否返回所属地
      $rule->setIsLocation(false);
      $value = '123456789123456789';
      var_dump($rule->passes($value));exit;
  }
```

### 备注

[](#备注)

1、仅支持大陆18位身份证验证。

### 更新

[](#更新)

- [changelog](./CHANGELOG.md)
    - 2022-04-29
    - 2021-10-28

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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 ~143 days

Recently: every ~213 days

Total

9

Last Release

617d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30b3d8cc986a1ad37a55169b11812fea1cae31430dd8dbe1b3436dc58cc885bd?d=identicon)[seffeng](/maintainers/seffeng)

---

Top Contributors

[![seffeng](https://avatars.githubusercontent.com/u/3509779?v=4)](https://github.com/seffeng "seffeng (20 commits)")

---

Tags

phplaravellumenyii2rulesseffeng

### Embed Badge

![Health badge](/badges/seffeng-rules/health.svg)

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

PHPackages © 2026

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