Captcha
in package
Image captcha class
Tags
Table of Contents
Properties
- $answer : string|null
- CAPTCHA answer length
- $config : array<string|int, mixed>
- CAPTCHA image config
- $expire : int
- CAPTCHA expiration
- $image : AbstractAdapter|null
- CAPTCHA image
- $length : int
- CAPTCHA length
- $reload : string
- CAPTCHA reload text
- $token : array<string|int, mixed>
- Current token data
- $uppercase : bool
- CAPTCHA uppercase flag
- $url : string|null
- CAPTCHA URL
Methods
- __construct() : mixed
- Constructor
- __toString() : string
- Print out the image
- createImage() : Captcha
- Create CAPTCHA image
- createNewToken() : Captcha
- Create CAPTCHA token
- getAnswer() : string|null
- Get CAPTCHA answer
- getConfig() : array<string|int, mixed>
- Get CAPTCHA image config
- getExpire() : int
- Get CAPTCHA expiration
- getImage() : AbstractAdapter|null
- Get CAPTCHA image
- getImageHtml() : string
- Get CAPTCHA image HTML
- getLength() : int
- Get CAPTCHA answer length
- getReload() : string
- Get CAPTCHA reload text
- getToken() : array<string|int, mixed>
- Get CAPTCHA token
- getUrl() : string|null
- Get CAPTCHA URL
- isUppercase() : bool
- Get CAPTCHA answer case
- random() : string
- Create random alphanumeric string
- setAnswer() : Captcha
- Set CAPTCHA answer
- setConfig() : Captcha
- Set CAPTCHA image config
- setExpire() : Captcha
- Set CAPTCHA expiration
- setLength() : Captcha
- Set CAPTCHA answer length
- setReload() : Captcha
- Set CAPTCHA reload text
- setUppercase() : Captcha
- Set CAPTCHA answer case
- setUrl() : Captcha
- Set CAPTCHA URL
Properties
$answer
CAPTCHA answer length
protected
string|null
$answer
= null
$config
CAPTCHA image config
protected
array<string|int, mixed>
$config
= ['adapter' => 'Gd', 'width' => 71, 'height' => 26, 'lineSpacing' => 5, 'lineColor' => [175, 175, 175], 'textColor' => [0, 0, 0], 'font' => null, 'size' => 0, 'rotate' => 0]
$expire
CAPTCHA expiration
protected
int
$expire
= 300
$image
CAPTCHA image
protected
AbstractAdapter|null
$image
= null
$length
CAPTCHA length
protected
int
$length
= 4
$reload
CAPTCHA reload text
protected
string
$reload
= 'Reload'
$token
Current token data
protected
array<string|int, mixed>
$token
= []
$uppercase
CAPTCHA uppercase flag
protected
bool
$uppercase
= true
$url
CAPTCHA URL
protected
string|null
$url
= null
Methods
__construct()
Constructor
public
__construct(string $url[, int $expire = 300 ][, array<string|int, mixed>|null $config = null ]) : mixed
Instantiate the captcha image object
Parameters
- $url : string
- $expire : int = 300
- $config : array<string|int, mixed>|null = null
__toString()
Print out the image
public
__toString() : string
Return values
stringcreateImage()
Create CAPTCHA image
public
createImage() : Captcha
Return values
CaptchacreateNewToken()
Create CAPTCHA token
public
createNewToken() : Captcha
Return values
CaptchagetAnswer()
Get CAPTCHA answer
public
getAnswer() : string|null
Return values
string|nullgetConfig()
Get CAPTCHA image config
public
getConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>getExpire()
Get CAPTCHA expiration
public
getExpire() : int
Return values
intgetImage()
Get CAPTCHA image
public
getImage() : AbstractAdapter|null
Return values
AbstractAdapter|nullgetImageHtml()
Get CAPTCHA image HTML
public
getImageHtml() : string
Return values
stringgetLength()
Get CAPTCHA answer length
public
getLength() : int
Return values
intgetReload()
Get CAPTCHA reload text
public
getReload() : string
Return values
stringgetToken()
Get CAPTCHA token
public
getToken() : array<string|int, mixed>
Return values
array<string|int, mixed>getUrl()
Get CAPTCHA URL
public
getUrl() : string|null
Return values
string|nullisUppercase()
Get CAPTCHA answer case
public
isUppercase() : bool
Return values
boolrandom()
Create random alphanumeric string
public
random([int $length = 8 ][, bool $case = false ]) : string
Parameters
- $length : int = 8
- $case : bool = false
Return values
stringsetAnswer()
Set CAPTCHA answer
public
setAnswer(string $answer) : Captcha
Parameters
- $answer : string
Return values
CaptchasetConfig()
Set CAPTCHA image config
public
setConfig(array<string|int, mixed> $config) : Captcha
Parameters
- $config : array<string|int, mixed>
Return values
CaptchasetExpire()
Set CAPTCHA expiration
public
setExpire(int $expire) : Captcha
Parameters
- $expire : int
Return values
CaptchasetLength()
Set CAPTCHA answer length
public
setLength(int $length) : Captcha
Parameters
- $length : int
Return values
CaptchasetReload()
Set CAPTCHA reload text
public
setReload(string $reload) : Captcha
Parameters
- $reload : string
Return values
CaptchasetUppercase()
Set CAPTCHA answer case
public
setUppercase(bool $uppercase) : Captcha
Parameters
- $uppercase : bool
Return values
CaptchasetUrl()
Set CAPTCHA URL
public
setUrl(string $url) : Captcha
Parameters
- $url : string