PHP 클래스 Toplan\Sms\SmsManager

파일 보기 프로젝트 열기: toplan/laravel-sms 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$input array 客户端数据
$state array 发送状态
$storage Toplan\Sms\Storage 存储器
$token string | null Access Token

공개 메소드들

메소드 설명
__construct ( string | null $token = null, array $input = [] ) Constructor
forgetRule ( string $field, string | null $name = null ) 从存储器中删除指定字段的指定名称的动态验证规则
forgetRules ( string $field ) : array 从存储中获取指定字段的所有验证规则
forgetState ( ) 从存储器中删除发送状态
generateResult ( boolean $pass, string $type, string $message = '', array $data = [] ) : array 合成结果数组
getCanResendTime ( ) : integer 从存储器中获取可再次发送的截止时间
input ( string | integer | null $key = null, mixed $default = null ) : mixed 获取客户端数据
pathOfUrl ( string $url, Closure $onError = null ) : string 获取路径中的path部分
requestVerifySms ( ) : array 请求验证码短信
requestVoiceVerify ( ) : array 请求语音验证码
retrieveAllData ( ) : array 从存储器中获取用户的所有数据
retrieveRule ( string $field, string | null $name = null ) : string | null 从存储器中获取指定字段的指定名称的动态验证规则
retrieveRules ( string $field ) : array 从存储中获取指定字段的所有验证规则
retrieveState ( string | null $name = null ) : array 从存储器中获取发送状态
setCanResendAfter ( integer $interval ) : integer 设置多少秒后才能再次请求
state ( string | integer | null $key = null, mixed $default = null ) : mixed 获取当前的发送状态(非持久化的)
storeRule ( string $field, string $name, string | null $rule = null ) 存储指定字段的指定名称的动态验证规则
updateState ( string | array $name, mixed $value = null ) 更新发送状态
validateFields ( mixed $input = null, Closure $validation = null ) : array 验证数据
validateSendable ( ) : array 验证是否可发送
vsprintf ( string $template, array $data, Closure $onError = null ) : string 根据模版和数据合成字符串

보호된 메소드들

메소드 설명
generateCode ( integer | null $length = null, string | null $characters = null ) : string 根据配置文件中的长度生成验证码
generateKey ( ) : string 生成key
generateSmsContent ( string $code, integer $minutes ) : string 生成验证码短信通用内容
generateTemplateData ( string $code, integer $minutes, string $type ) : array 生成模版数据
getCodeValidMinutes ( ) : integer 从配置文件获取验证码有效时间(分钟)
getFields ( ) : array 获取可验证的字段
getInterval ( ) : integer 从配置文件获取可再次请求的最小时间间隔(秒)
getMobileField ( ) : string 获取手机号的字段名
getNameOfDefaultStaticRule ( string $field ) : string 获取指定字段的默认静态规则的名称
getNotifyMessage ( string $name ) : string 从配置文件获取提示信息
getRealRuleByName ( string $field, string $ruleName ) : string 根据规则名获取真实的验证规则
getStaticRule ( $field, $ruleName ) : string | null 获取指定字段的指定名称的静态验证规则
getStorageClassName ( ) : string 获取存储器类名
getTemplatesByKey ( string $key ) : array 从配置信息中获取指定键名的所有模版id
getValidationConfigByField ( string $field ) : array 获取验证配置
reset ( ) 重置发送状态
storage ( ) : Toplan\Sms\Storage 获取存储器
storeState ( ) 存储发送状态
useRule ( string $field, string $name ) 设置指定字段使用的验证规则名称
usedRule ( string $field ) : string 获取设置指定字段使用的验证规则名称
validateFieldName ( $name ) 检查字段名称是否合法
verifyCode ( ) : string 生成待发生的验证码
whetherValidateFiled ( string $field ) : boolean 是否检查指定的数据

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( string | null $token = null, array $input = [] )
$token string | null
$input array

forgetRule() 공개 메소드

从存储器中删除指定字段的指定名称的动态验证规则
public forgetRule ( string $field, string | null $name = null )
$field string
$name string | null

forgetRules() 공개 메소드

从存储中获取指定字段的所有验证规则
public forgetRules ( string $field ) : array
$field string
리턴 array

forgetState() 공개 메소드

从存储器中删除发送状态
public forgetState ( )

generateCode() 보호된 정적인 메소드

根据配置文件中的长度生成验证码
protected static generateCode ( integer | null $length = null, string | null $characters = null ) : string
$length integer | null
$characters string | null
리턴 string

generateKey() 보호된 메소드

生成key
protected generateKey ( ) : string
리턴 string

generateResult() 공개 정적인 메소드

合成结果数组
public static generateResult ( boolean $pass, string $type, string $message = '', array $data = [] ) : array
$pass boolean
$type string
$message string
$data array
리턴 array

generateSmsContent() 보호된 메소드

生成验证码短信通用内容
protected generateSmsContent ( string $code, integer $minutes ) : string
$code string
$minutes integer
리턴 string

generateTemplateData() 보호된 메소드

生成模版数据
protected generateTemplateData ( string $code, integer $minutes, string $type ) : array
$code string
$minutes integer
$type string
리턴 array

getCanResendTime() 공개 메소드

从存储器中获取可再次发送的截止时间
public getCanResendTime ( ) : integer
리턴 integer

getCodeValidMinutes() 보호된 정적인 메소드

从配置文件获取验证码有效时间(分钟)
protected static getCodeValidMinutes ( ) : integer
리턴 integer

getFields() 보호된 정적인 메소드

获取可验证的字段
protected static getFields ( ) : array
리턴 array

getInterval() 보호된 정적인 메소드

从配置文件获取可再次请求的最小时间间隔(秒)
protected static getInterval ( ) : integer
리턴 integer

getMobileField() 보호된 정적인 메소드

获取手机号的字段名
protected static getMobileField ( ) : string
리턴 string

getNameOfDefaultStaticRule() 보호된 정적인 메소드

获取指定字段的默认静态规则的名称
protected static getNameOfDefaultStaticRule ( string $field ) : string
$field string
리턴 string

getNotifyMessage() 보호된 정적인 메소드

从配置文件获取提示信息
protected static getNotifyMessage ( string $name ) : string
$name string
리턴 string

getRealRuleByName() 보호된 메소드

- 首先尝试使用指定名称的静态验证规则 - 其次尝试使用指定名称的动态验证规则 - 最后尝试使用配置文件中的默认静态验证规则
protected getRealRuleByName ( string $field, string $ruleName ) : string
$field string
$ruleName string
리턴 string

getStaticRule() 보호된 정적인 메소드

获取指定字段的指定名称的静态验证规则
protected static getStaticRule ( $field, $ruleName ) : string | null
$field
$ruleName
리턴 string | null

getStorageClassName() 보호된 정적인 메소드

获取存储器类名
protected static getStorageClassName ( ) : string
리턴 string

getTemplatesByKey() 보호된 정적인 메소드

从配置信息中获取指定键名的所有模版id
protected static getTemplatesByKey ( string $key ) : array
$key string
리턴 array

getValidationConfigByField() 보호된 정적인 메소드

获取验证配置
protected static getValidationConfigByField ( string $field ) : array
$field string
리턴 array

input() 공개 메소드

获取客户端数据
public input ( string | integer | null $key = null, mixed $default = null ) : mixed
$key string | integer | null
$default mixed
리턴 mixed

pathOfUrl() 공개 정적인 메소드

获取路径中的path部分
public static pathOfUrl ( string $url, Closure $onError = null ) : string
$url string
$onError Closure
리턴 string

requestVerifySms() 공개 메소드

请求验证码短信
public requestVerifySms ( ) : array
리턴 array

requestVoiceVerify() 공개 메소드

请求语音验证码
public requestVoiceVerify ( ) : array
리턴 array

reset() 보호된 메소드

重置发送状态
protected reset ( )

retrieveAllData() 공개 메소드

从存储器中获取用户的所有数据
public retrieveAllData ( ) : array
리턴 array

retrieveRule() 공개 메소드

从存储器中获取指定字段的指定名称的动态验证规则
public retrieveRule ( string $field, string | null $name = null ) : string | null
$field string
$name string | null
리턴 string | null

retrieveRules() 공개 메소드

从存储中获取指定字段的所有验证规则
public retrieveRules ( string $field ) : array
$field string
리턴 array

retrieveState() 공개 메소드

从存储器中获取发送状态
public retrieveState ( string | null $name = null ) : array
$name string | null
리턴 array

setCanResendAfter() 공개 메소드

设置多少秒后才能再次请求
public setCanResendAfter ( integer $interval ) : integer
$interval integer
리턴 integer

state() 공개 메소드

获取当前的发送状态(非持久化的)
public state ( string | integer | null $key = null, mixed $default = null ) : mixed
$key string | integer | null
$default mixed
리턴 mixed

storage() 보호된 정적인 메소드

获取存储器
protected static storage ( ) : Toplan\Sms\Storage
리턴 Toplan\Sms\Storage

storeRule() 공개 메소드

存储指定字段的指定名称的动态验证规则
public storeRule ( string $field, string $name, string | null $rule = null )
$field string
$name string
$rule string | null

storeState() 보호된 메소드

存储发送状态
protected storeState ( )

updateState() 공개 메소드

更新发送状态
public updateState ( string | array $name, mixed $value = null )
$name string | array
$value mixed

useRule() 보호된 메소드

设置指定字段使用的验证规则名称
protected useRule ( string $field, string $name )
$field string
$name string

usedRule() 보호된 메소드

获取设置指定字段使用的验证规则名称
protected usedRule ( string $field ) : string
$field string
리턴 string

validateFieldName() 보호된 정적인 메소드

检查字段名称是否合法
protected static validateFieldName ( $name )
$name

validateFields() 공개 메소드

验证数据
public validateFields ( mixed $input = null, Closure $validation = null ) : array
$input mixed
$validation Closure
리턴 array

validateSendable() 공개 메소드

验证是否可发送
public validateSendable ( ) : array
리턴 array

verifyCode() 보호된 메소드

生成待发生的验证码
protected verifyCode ( ) : string
리턴 string

vsprintf() 공개 정적인 메소드

根据模版和数据合成字符串
public static vsprintf ( string $template, array $data, Closure $onError = null ) : string
$template string
$data array
$onError Closure
리턴 string

whetherValidateFiled() 보호된 정적인 메소드

是否检查指定的数据
protected static whetherValidateFiled ( string $field ) : boolean
$field string
리턴 boolean

프로퍼티 상세

$input 보호되어 있는 프로퍼티

客户端数据
protected array $input
리턴 array

$state 보호되어 있는 프로퍼티

发送状态
protected array $state
리턴 array

$storage 보호되어 있는 정적으로 프로퍼티

存储器
protected static Storage,Toplan\Sms $storage
리턴 Toplan\Sms\Storage

$token 보호되어 있는 프로퍼티

Access Token
protected string|null $token
리턴 string | null