Skip to content
lushaomingPublic

About

简单易用的PHP验证码,composer一键安装,可实现自定义验证码样式。Easy-to-use PHP verification code.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

How to install?

  • Use composer command : composer require lsmverify/lsmverify
  • No composer? click here to download and install composer.

How to use this package?

<?php
/**
 * Created by PhpStorm.
 * User: Shannon
 * Date: 2019/4/3
 * Time: 15:35
 */
require_once ('../vendor/autoload.php');
use LsmVerify\Verify\VerifyCode;

// default setting
// string verify code img output
VerifyCode::getInstance()->createCodeImg();
// simple computational verification code img output
VerifyCode::getInstance()->createComputeCode();

// If you want to customize the parameters, you can pass in an array parameter, like this:
$baseConfig = [
    'width' => 130,// image width
    'height' => 40,// image height
    'length' => 4,// code length
    'obstruction' => false,// has obstruction? true or false
    'onlyNumber' => false,// only number? true or false
    'textColor' => [50, 50, 255],// RGB
    'backColor' => [255, 255, 255],// RGB
    'font' => __DIR__ . '/basic.TTF',
    'fontSize' => 20,
    'maxNumber' => 20,// max number of compute code
];
VerifyCode::getInstance()->createCodeImg($baseConfig);
VerifyCode::getInstance()->createComputeCode($baseConfig);

/** check verify code **/
$code = '1234';
$result = VerifyCode::getInstance()->checkCode($code);
// VerifyCode::getInstance()->checkCode($code);return true or false

About

简单易用的PHP验证码,composer一键安装,可实现自定义验证码样式。Easy-to-use PHP verification code.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages