Download the PHP package mhhex/sms-verify-code without Composer

On this page you can find all versions of the php package mhhex/sms-verify-code. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sms-verify-code

sms-verify-code

适用于 thinkphp >= 6.0.0 的短信验证码生成、缓存、验证类库

主要特性

安装

composer require mhhex/sms-verify-code

使用文档

声明

use mhhex\SmsVerifyCode;

生成验证码验证一

// 生成验证码并缓存
// 默认生成 6 位数字验证码,默认获取前端输入的手机号字段名为 mobile
$code = (new SmsVerifyCode())->create();

// 验证短信验证码
// 默认获取前端输入的手机号字段名为 mobile,验证码字段名为 code
$smsVerifyCode = new SmsVerifyCode();
if(! $smsVerifyCode->check()){
    // 验证失败,获取失败信息
    $msg = $smsVerifyCode->getErrorMsg();
}

生成验证码验证二

// 手动传入号码示例
$code = (new SmsVerifyCode())->mobile('18888888888')->create();

// 手动传入号码和验证码进行验证示例
$smsVerifyCode = new SmsVerifyCode();
$smsVerifyCode->mobile('18888888888')->code('123456')->check();

验证场景

// 生成登录(login)场景的验证码并缓存
$code = (new SmsVerifyCode())->scene('login')->create();

// 验证登录(login)场景短信验证码
$smsVerifyCode = new SmsVerifyCode();
if(! $smsVerifyCode->scene('login')->check()){
    // 验证失败,获取失败信息
    $msg = $smsVerifyCode->getErrorMsg();
}

验证码类型

type 值 验证码类型
1 纯数字型验证码
2 纯小写字母型验证码
3 纯大写字母型验证码
4 数字与小写字母混合型验证码
5 数字与大写字母混合型验证码
6 小写字母与大写字母混合型验证码
7 数字、小写字母和大写字母混合型验证码
// 生成数字与大写字母混合型验证码并缓存
$code = (new SmsVerifyCode(['type'=>5]))->create();

动态配置

配置项 默认值 说明
expire 180 验证码过期时间(秒)
length 6 验证码长度
type 1 验证码类型
mobileName mobile 获取前端传入的手机字段名
codeName code 获取前端传入的短信验证码名
$config = ['type'=>1,'length'=>4];
$smsVerifyCode = new SmsVerifyCode($config);

版权信息

TpSms遵循Apache2开源协议发布,并提供免费使用。


All versions of sms-verify-code with dependencies

PHP Build Version
Package Version
Requires topthink/framework Version ^6.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mhhex/sms-verify-code contains the following files

Loading the files please wait ....