PHPackages                             chenbool/verify - 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. chenbool/verify

ActiveLibrary

chenbool/verify
===============

这是一个php插件

1.0.0(6y ago)05MITPHPPHP &gt;=5.6.0

Since Jan 10Pushed 2w ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP 验证工具类
=========

[](#php-验证工具类)

一个轻量级的 PHP 验证工具类，用于验证 IP 地址、手机号、邮箱等常用功能。

特性
--

[](#特性)

- 验证 IP 地址（IPv4/IPv6）
- 验证邮箱格式
- 检测手机设备访问
- 检测微信访问
- 验证手机号码格式
- 验证固定电话格式
- 检测 HTTPS 请求

项目结构
----

[](#项目结构)

```
verify/
├── src/                    # 源代码
│   └── Verify.php         # 验证工具类
├── composer.json            # 依赖配置
├── composer.lock
└── README.md

```

安装
--

[](#安装)

```
composer require chenbool/verify
```

使用方法
----

[](#使用方法)

### 初始化

[](#初始化)

```
use ChenBool\Verify;

$verify = new Verify();
```

### 验证 IP 地址

[](#验证-ip-地址)

```
// 判断是否为合法的 IP 地址
$ipv4 = $verify->isIPAddress('192.168.1.1');   // 返回 4
$ipv6 = $verify->isIPAddress('2001:0db8:85a3:0000:0000:8a2e:0370:7334'); // 返回 6
$invalid = $verify->isIPAddress('invalid');     // 返回 false
```

### 验证邮箱

[](#验证邮箱)

```
// 验证邮箱格式
$verify->isValidEmail('test@example.com');  // true
$verify->isValidEmail('invalid');            // false
```

### 检测客户端类型

[](#检测客户端类型)

```
// 判断是否为手机访问
$verify->isMobile();  // true 或 false

// 判断是否为微信访问
$verify->isWeiXin();  // true 或 false

// 判断是否为 HTTPS 请求
$verify->isHttps();   // true 或 false
```

### 验证手机号码

[](#验证手机号码)

```
// 检查手机号码格式（中国大陆手机号）
$verify->checkMobile('13800138000');  // true
$verify->checkMobile('1234567890');    // false
```

### 验证固定电话

[](#验证固定电话)

```
// 检查固定电话格式
$verify->checkTelephone('010-12345678');  // true
$verify->checkTelephone('0571-12345678'); // true
$verify->checkTelephone('12345678');      // false
```

API 说明
------

[](#api-说明)

方法说明返回值`isIPAddress($ip)`验证 IP 地址4 (IPv4) / 6 (IPv6) / false`isValidEmail($email)`验证邮箱格式true / false`isMobile()`检测手机设备访问true / false`isWeiXin()`检测微信访问true / false`checkMobile($mobile)`验证手机号码true / false`checkTelephone($tel)`验证固定电话true / false`isHttps()`检测 HTTPS 请求true / false环境要求
----

[](#环境要求)

- PHP &gt;= 5.6.0

相关链接
----

[](#相关链接)

- [PHP filter\_var](https://www.php.net/manual/en/function.filter-var.php)
- [正则表达式手册](https://www.php.net/manual/en/book.pcre.php)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance63

Regular maintenance activity

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

2320d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b4506ec16c09e94c51dd05a0491de5b0d7065073e7e917b73d810819423523f?d=identicon)[chenbool](/maintainers/chenbool)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/chenbool-verify/health.svg)

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

PHPackages © 2026

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