PHP 클래스 Toplan\PhpSms\Sms

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

보호된 프로퍼티들

프로퍼티 타입 설명
$_status_before_enqueue_ array Status container, store some configuration information before serialize current instance(before enqueue).
$agents array The instances of Agent.
$agentsConfig array The configuration information of agents.
$availableHooks array The available hooks for balancing task.
$enableQueue boolean Whether to use the queue.
$firstAgent string | null The name of first agent.
$howToUseQueue Closure How to use the queue.
$pushedToQueue boolean Whether the current instance has already pushed to the queue system.
$scheme array example: [ 'Agent1' => '10 backup', 'Agent2' => '20 backup', ]
$serializer SuperClosure\Serializer An instance of class [SuperClosure\Serializer] for serialize closure objects.
$smsData array The data container of SMS/voice verify.

공개 메소드들

메소드 설명
__call ( string $name, array $args ) Overload method.
__callStatic ( string $name, array $args ) Overload static method.
__construct ( boolean $autoBoot = true ) Constructor
__sleep ( ) : array Serialize magic method.
__wakeup ( ) Deserialize magic method.
agent ( string $name ) Set the first agent by name.
bootstrap ( ) Boot balancing task for send SMS/voice verify.
cleanConfig ( ) Tear down all the configuration information of agent.
cleanScheme ( ) Tear down agent use scheme and prepare to create and start a new balancing task, so before do it must destroy old task instance.
config ( mixed $name = null, mixed $config = null, boolean $override = false ) : array Set or get configuration information by agent name.
content ( string $content ) Set the content for content SMS.
data ( array $data ) Set the template data for template SMS.
getAgent ( string $name ) : mixed Get a sms agent instance by agent name, if null, will try to create a new agent instance.
getData ( null | string $name = null ) : mixed Get all the data of SMS/voice verify.
getTask ( ) : Toplan\TaskBalance\Task Get or generate a balancing task instance for send SMS/voice verify.
hasAgent ( string $name ) : boolean Whether to has specified agent.
make ( mixed $agentName = null, mixed $tempId = null ) : Sms Create a sms instance send SMS, your can also set SMS templates or content at the same time.
push ( ) : mixed Push to the queue by a custom method.
queue ( mixed $enable = null, mixed $handler = null ) : boolean Set whether to use the queue system, and define how to use it.
scheme ( mixed $name = null, mixed $scheme = null ) : mixed Set or get the dispatch scheme of agent by name.
send ( boolean $immediately = false ) : mixed Start send SMS/voice verify.
template ( mixed $name, mixed $tempId = null ) Set the template id for template SMS.
to ( string $mobile ) Set the recipient`s mobile number.
voice ( integer | string | null $code = null ) : Sms Create a sms instance send voice verify, your can also set verify code at the same time.

보호된 메소드들

메소드 설명
configuration ( ) Configuration.
getSerializer ( ) : SuperClosure\Serializer Get a closure serializer.
initAgentsConfig ( array $agents, array &$config ) Try to initialize the specified agents` configuration information.
initScheme ( array &$config ) Try to read the dispatch scheme of agent from config file.
initTask ( ) Initialize the task.
modifyConfig ( string $key, array $value ) Modify the configuration information of agent by name.
modifyScheme ( $key, $value ) Modify the dispatch scheme of agent by name.
parseScheme ( array $options ) : array Parsing the dispatch scheme.
reinstallHandlers ( array $handlers ) Reinstall hooks` handlers for balancing task.
serializeHandlers ( ) : array Serialize the hooks` handlers of balancing task
serializeOrDeserializeClosureAndReplace ( array &$options, integer | string $key ) Serialize/deserialize the specified closure and replace the origin value.
serializeOrDeserializeScheme ( array $scheme ) : array Serialize or deserialize the agent use scheme.
taskInitialized ( ) : boolean Whether task initialized.
validateAgentName ( string $name ) Validate the agent name.
validateConfig ( ) validate configuration.

메소드 상세

__call() 공개 메소드

Overload method.
public __call ( string $name, array $args )
$name string
$args array

__callStatic() 공개 정적인 메소드

Overload static method.
public static __callStatic ( string $name, array $args )
$name string
$args array

__construct() 공개 메소드

Constructor
public __construct ( boolean $autoBoot = true )
$autoBoot boolean

__sleep() 공개 메소드

Serialize magic method.
public __sleep ( ) : array
리턴 array

__wakeup() 공개 메소드

Deserialize magic method.
public __wakeup ( )

agent() 공개 메소드

Set the first agent by name.
public agent ( string $name )
$name string

bootstrap() 공개 정적인 메소드

Boot balancing task for send SMS/voice verify.
public static bootstrap ( )

cleanConfig() 공개 정적인 메소드

Tear down all the configuration information of agent.
public static cleanConfig ( )

cleanScheme() 공개 정적인 메소드

Tear down agent use scheme and prepare to create and start a new balancing task, so before do it must destroy old task instance.
public static cleanScheme ( )

config() 공개 정적인 메소드

Set or get configuration information by agent name.
public static config ( mixed $name = null, mixed $config = null, boolean $override = false ) : array
$name mixed
$config mixed
$override boolean
리턴 array

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

Configuration.
protected static configuration ( )

content() 공개 메소드

Set the content for content SMS.
public content ( string $content )
$content string

data() 공개 메소드

Set the template data for template SMS.
public data ( array $data )
$data array

getAgent() 공개 정적인 메소드

Get a sms agent instance by agent name, if null, will try to create a new agent instance.
public static getAgent ( string $name ) : mixed
$name string
리턴 mixed

getData() 공개 메소드

Get all the data of SMS/voice verify.
public getData ( null | string $name = null ) : mixed
$name null | string
리턴 mixed

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

Get a closure serializer.
protected static getSerializer ( ) : SuperClosure\Serializer
리턴 SuperClosure\Serializer

getTask() 공개 정적인 메소드

Get or generate a balancing task instance for send SMS/voice verify.
public static getTask ( ) : Toplan\TaskBalance\Task
리턴 Toplan\TaskBalance\Task

hasAgent() 공개 정적인 메소드

Whether to has specified agent.
public static hasAgent ( string $name ) : boolean
$name string
리턴 boolean

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

Try to initialize the specified agents` configuration information.
protected static initAgentsConfig ( array $agents, array &$config )
$agents array
$config array

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

Try to read the dispatch scheme of agent from config file.
protected static initScheme ( array &$config )
$config array

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

Initialize the task.
protected static initTask ( )

make() 공개 정적인 메소드

Create a sms instance send SMS, your can also set SMS templates or content at the same time.
public static make ( mixed $agentName = null, mixed $tempId = null ) : Sms
$agentName mixed
$tempId mixed
리턴 Sms

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

Modify the configuration information of agent by name.
protected static modifyConfig ( string $key, array $value )
$key string
$value array

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

Modify the dispatch scheme of agent by name.
protected static modifyScheme ( $key, $value )
$key
$value

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

解析代理器的数组模式的调度配置
protected static parseScheme ( array $options ) : array
$options array
리턴 array

push() 공개 메소드

Push to the queue by a custom method.
public push ( ) : mixed
리턴 mixed

queue() 공개 정적인 메소드

Set whether to use the queue system, and define how to use it.
public static queue ( mixed $enable = null, mixed $handler = null ) : boolean
$enable mixed
$handler mixed
리턴 boolean

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

Reinstall hooks` handlers for balancing task.
protected static reinstallHandlers ( array $handlers )
$handlers array

scheme() 공개 정적인 메소드

Set or get the dispatch scheme of agent by name.
public static scheme ( mixed $name = null, mixed $scheme = null ) : mixed
$name mixed
$scheme mixed
리턴 mixed

send() 공개 메소드

If give a true parameter, this system will immediately start request to send SMS/voice verify whatever whether to use the queue. if you are already pushed sms instance to the queue, you can recall the method send() in queue system without true parameter, so this mechanism in order to make you convenient use the method send() in queue system.
public send ( boolean $immediately = false ) : mixed
$immediately boolean
리턴 mixed

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

Serialize the hooks` handlers of balancing task
protected static serializeHandlers ( ) : array
리턴 array

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

Serialize/deserialize the specified closure and replace the origin value.
protected static serializeOrDeserializeClosureAndReplace ( array &$options, integer | string $key )
$options array
$key integer | string

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

Serialize or deserialize the agent use scheme.
protected static serializeOrDeserializeScheme ( array $scheme ) : array
$scheme array
리턴 array

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

Note: 判断drivers是否为空不能用'empty',因为在TaskBalance库的中Task类的drivers属性是受保护的(不可访问), 虽然通过魔术方法可以获取到其值,但在其目前版本(v0.4.2)其内部却并没有使用'__isset'魔术方法对'empty'或'isset'函数进行逻辑补救.
protected static taskInitialized ( ) : boolean
리턴 boolean

template() 공개 메소드

Set the template id for template SMS.
public template ( mixed $name, mixed $tempId = null )
$name mixed
$tempId mixed

to() 공개 메소드

Set the recipient`s mobile number.
public to ( string $mobile )
$mobile string

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

Agent name must be a string, but not be a number string
protected static validateAgentName ( string $name )
$name string

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

validate configuration.
protected static validateConfig ( )

voice() 공개 정적인 메소드

Create a sms instance send voice verify, your can also set verify code at the same time.
public static voice ( integer | string | null $code = null ) : Sms
$code integer | string | null
리턴 Sms

프로퍼티 상세

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

Status container, store some configuration information before serialize current instance(before enqueue).
protected array $_status_before_enqueue_
리턴 array

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

The instances of Agent.
protected static array $agents
리턴 array

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

The configuration information of agents.
protected static array $agentsConfig
리턴 array

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

The available hooks for balancing task.
protected static array $availableHooks
리턴 array

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

Whether to use the queue.
protected static bool $enableQueue
리턴 boolean

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

The name of first agent.
protected string|null $firstAgent
리턴 string | null

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

How to use the queue.
protected static Closure $howToUseQueue
리턴 Closure

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

Whether the current instance has already pushed to the queue system.
protected bool $pushedToQueue
리턴 boolean

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

example: [ 'Agent1' => '10 backup', 'Agent2' => '20 backup', ]
protected static array $scheme
리턴 array

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

An instance of class [SuperClosure\Serializer] for serialize closure objects.
protected static Serializer,SuperClosure $serializer
리턴 SuperClosure\Serializer

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

The data container of SMS/voice verify.
protected array $smsData
리턴 array