项目作者: lushaoming

项目描述 :
简单易用的PHP验证码,composer一键安装,可实现自定义验证码样式。Easy-to-use PHP verification code.
高级语言: PHP
项目地址: git://github.com/lushaoming/verify.git
创建时间: 2019-04-03T06:27:51Z
项目社区:https://github.com/lushaoming/verify

开源协议:Apache License 2.0

下载


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
    <?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