PHPackages                             zyan/beautiful - 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. zyan/beautiful

ActiveLibrary

zyan/beautiful
==============

通用靓号检测规则

1.0.0(3y ago)55502MITPHP

Since Nov 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/aa24615/beautiful)[ Packagist](https://packagist.org/packages/zyan/beautiful)[ RSS](/packages/zyan-beautiful/feed)WikiDiscussions master Synced 1mo ago

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

zyan/beautiful
==============

[](#zyanbeautiful)

这是一个通用靓号检测,手机靓号正则规则
可用于检测手机号,座机号,QQ号等数字类账号

内置规则

- AAA
- AAAA
- AAAAA
- AAAAAA
- AABB
- AABBCC
- AABBCCDD
- ABABAB
- ABCDEF
- ABCABC
- ABCDABCD

要求
--

[](#要求)

1. php &gt;= 7.2
2. Composer

安装
--

[](#安装)

```
composer require zyan/beautiful -vvv
```

使用
--

[](#使用)

```
use Zyan\beautiful\beautiful;

Beautiful::go('15912345678');
```

配置
--

[](#配置)

```
Beautiful::config(
    ['靓号规则 比如 AAAA AABB ABCD...'],
    ['处理类型: mobile为手机号(只取后8位) 不传为通用,也就是对输入源不作任何处理']
);

//合并默认配置规则 也就是默认的规则上加上新的规则
Beautiful::config(['AAAA','AAABBB','AABB'],['mobile']);

//重新设置新规则 会复盖默认的规则
Beautiful::setConfig(['AAAA','AAABBB','AABB'],['mobile']);

//获取当前全局配置
Beautiful::getConfig();

//以上都是全局配置
//如果某对某一次的检测单独设置请传入到后面
Beautiful::go('15912345678',['AAAA','AAABBB','AABB'],['mobile']);
```

匹配靓号
----

[](#匹配靓号)

```
Beautiful::go('15912345678');
// ['ABCDEF']
```

返回命中规则 多个返回多个 未命中返回空数组

实现自已的规则
-------

[](#实现自已的规则)

您需要继承 `Zyan\Beautiful\RulesInterface`
实现 `public static function go(string $str): bool` 方法
示例如下:

```
namespace Zyan\Beautiful\Rules;

use Zyan\Beautiful\RulesInterface;

/**
 * Class ABCDEF.
 *
 * @package Zyan\Beautiful\Rules
 *
 * @author 读心印
 */
class ABCDEF implements RulesInterface
{
    public static function go(string $str): bool
    {
        $isMatched = preg_match_all('/^\d(?:(?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)|9(?=0)){5,})\d/m', $str, $matches);
        return $isMatched>0 ? true : false;
    }
}
```

可使用 `Beautiful::setRules(string $name,RulesInterface $value)` 方法进行配置

```
Beautiful::setRules('ABCDEF',Zyan/Beautiful/Rules/ABCDEF:class); //这个class取决于您的命名空间
```

接下来您就可以使用了

```
Beautiful::go('15912345678',['ABCDEF']); //全局配置请用 Beautiful::Config(['ABCDEF'])
// ['ABCDEF']
```

参与贡献
----

[](#参与贡献)

1. fork 当前库到你的名下
2. 在你的本地修改完成审阅过后提交到你的仓库
3. 提交 PR 并描述你的修改，等待合并

License
-------

[](#license)

[MIT license](https://opensource.org/licenses/MIT)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

1288d ago

### Community

Maintainers

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

---

Top Contributors

[![aa24615](https://avatars.githubusercontent.com/u/33275679?v=4)](https://github.com/aa24615 "aa24615 (6 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zyan-beautiful/health.svg)

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

PHPackages © 2026

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