PHPackages                             ycpfzf/vcode - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. ycpfzf/vcode

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

ycpfzf/vcode
============

laravel sms&amp;email validdate code

1.0(5y ago)1982Apache-2.0PHPPHP &gt;=7.0.0

Since Jun 18Pushed 5y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

使用方法
----

[](#使用方法)

这是一个在laravel上使用发送和验证验证码的工具，可以选择是短信或邮件发送验证码。

#### 安装

[](#安装)

1 使用composer安装依赖

```
composer require ycpfzf/vcode
```

2 发布资源

```
php artisan vendor:publish
```

在列表中选择 Ycpfzf\\Vcode\\VcodeServiceProvider，运行完毕会在config文件夹生成配置文件vcode.php

#### 使用

[](#使用)

1 短信验证码

使用阿里云的短信，请先在配置文件config/vcode.php中配置好参数

```
//不指定场景时使用配置文件中 ['sms']['templates']里的 default键指定的模板发送短信
 Ycpfzf\Vcode\Vcode::sms()->name('13800138000')->send();

 //指定场景 login ,必须在配置文件中的 ['sms']['templates']里有login键，并指定模版
 Ycpfzf\Vcode\Vcode::sms()->name('13800138000')->scene('login')->send();
```

2 邮件验证码

使用laravel的Mail发送邮件，所以请先配置后发件参数

```
//不指定场景时，默认是default
 Ycpfzf\Vcode\Vcode::email()->name('user@test.com')->subject('验证码')->send();

//指定场景时，配置文件中的 ['email']['templates']指定使用的模板文件
 Ycpfzf\Vcode\Vcode::email()->name('user@test.com')->subject('验证码')->scene('login')->send();

 //向模板传递参数，请注意 $code是要发送的验证码
 Ycpfzf\Vcode\Vcode::email()->name('user@test.com')->subject('验证码')->scene('login')->assgin($data)->send();
```

3 验证验证码是否正确

```
if(Ycpfzf\Vcode\Vcode::email()->name('user@test.com')->check(353283)){
    echo '验证成功了';
}else{
    echo '验证码不正确';
}

//如果是短信验证码，将上面的email()方法换成sms()
```

4 使用队列发送

请先配置好队列，否则可能返回发送成功，但实际没有发送

```
 Ycpfzf\Vcode\Vcode::sms()->name('13800138000')->queue();
 Ycpfzf\Vcode\Vcode::email()->name('user@test.com')->subject('验证码')->queue();
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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

Total

4

Last Release

1901d ago

Major Versions

0.7.1 → 1.02021-03-04

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravelemailsmsvalidate

### Embed Badge

![Health badge](/badges/ycpfzf-vcode/health.svg)

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

###  Alternatives

[synergitech/laravel-postal

This library integrates Postal with the standard Laravel mail framework.

38107.1k](/packages/synergitech-laravel-postal)[ferdous/laravel-otp-validate

Laravel package for OTP validation with built-in features like retry and resend mechanism. Built in max retry and max resend blocking. OTP/Security Code can be send over SMS or Email of your choice with user-defined template.

7124.4k](/packages/ferdous-laravel-otp-validate)[juanparati/brevosuite

Complete Brevo integration with Laravel

1010.8k](/packages/juanparati-brevosuite)

PHPackages © 2026

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