PHPackages                             chenkby/yii2-mobile-validator - 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. chenkby/yii2-mobile-validator

ActiveYii2-extension[Validation &amp; Sanitization](/categories/validation)

chenkby/yii2-mobile-validator
=============================

手机号码验证(中国)

v1.0(8y ago)111BSD-3-ClausePHP

Since Oct 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/chenkby/yii2-mobile-validator)[ Packagist](https://packagist.org/packages/chenkby/yii2-mobile-validator)[ RSS](/packages/chenkby-yii2-mobile-validator/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

yii2-mobile-validator
=====================

[](#yii2-mobile-validator)

Yii2 手机号码验证器

安装
--

[](#安装)

添加到你的composer.json文件

```
"chenkby/yii2-mobile-validator": "*"

```

或

```
composer require "chenkby/yii2-mobile-validator:*"

```

使用
--

[](#使用)

在model的rule中：

```
    public function rules()
    {
        ...
        ['mobile', \chenkby\mobileValidator\MobilePhoneValidator::className()],
        ...
    }
```

属性
--

[](#属性)

**注意：本验证器默认使用宽松正则(/^1\[1234567890\]\\d{9}$/)**

$serviceRegex: 服务器端正则表达式

$clientRegex: 客户端正则表达式

```
    public function rules()
    {
        ...
        ['mobile', \chenkby\mobileValidator\MobilePhoneValidator::className(), 'serverRegex' => "/^1[1234567890]\d{9}$/", 'clientRegex' => "/^1[1234567890]\d{9}$/"],
        ...
    }
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Unknown

Total

1

Last Release

3134d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/35e20aecf431c03a9ea9cbfd44180e97599e2d9db47ca87c408ee16173c5c1a2?d=identicon)[chenkby](/maintainers/chenkby)

---

Top Contributors

[![chenkby](https://avatars.githubusercontent.com/u/13486227?v=4)](https://github.com/chenkby "chenkby (3 commits)")

---

Tags

mobilevalidatoryii2yii2mobile number validate

### Embed Badge

![Health badge](/badges/chenkby-yii2-mobile-validator/health.svg)

```
[![Health](https://phpackages.com/badges/chenkby-yii2-mobile-validator/health.svg)](https://phpackages.com/packages/chenkby-yii2-mobile-validator)
```

###  Alternatives

[borales/yii2-phone-input

Yii2 International telephone numbers - Asset Bundle, Behavior, Validator, Widget

1341.6M6](/packages/borales-yii2-phone-input)[codeonyii/yii2-at-least-validator

Validates at least one (or more) attributes.

28253.5k1](/packages/codeonyii-yii2-at-least-validator)[arogachev/yii2-many-to-many

Many-to-many ActiveRecord relation for Yii 2 framework

3541.2k4](/packages/arogachev-yii2-many-to-many)[yii2mod/yii2-validators

Collection of useful validators for Yii Framework 2.0

1816.8k](/packages/yii2mod-yii2-validators)

PHPackages © 2026

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