zablose/captcha 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

zablose/captcha

最新稳定版本:4.1.0

Composer 安装命令:

composer require zablose/captcha

包简介

Simple captcha with optional goodies for Laravel.

README 文档

README

Captcha

Simple captcha with optional goodies for Laravel.

Installation

composer require zablose/captcha

Usage with Laravel

New Route & Captcha Types

Check new route is working, by visiting /captcha or /captcha/{type}.

Captcha Type Dev Link
default /captcha/default
small /captcha/small
invert /captcha/invert
sharpness /captcha/sharpness
blur /captcha/blur
contrast /captcha/contrast
no-angle /captcha/no-angle
bg-color /captcha/bg-color

Look at the config file for more details.

Login Form

If standard auth is in use, add captcha to your login form like in the login.blade.php template.

Validation

If standard auth is in use, overwrite method validateLogin like in LoginController class.

Basic Usage

In case you are not a happy Laravel user, you may still use this package.

Create captcha, add details to the session and output the image.

A code may look like:

<?php

require __DIR__ . '/../vendor/autoload.php';

use Zablose\Captcha\Captcha;
use Zablose\Captcha\Config;
use Zablose\Captcha\Image;

$captcha = new Captcha(
    new Image(
        (new Config())->update(['invert' => true, 'width' => 220])
    )
);

$data = [
    'captcha' => [
        'sensitive' => $captcha->isSensitive(),
        'hash' => $captcha->hash(),
    ],
];

// Add $data to the session.

echo $captcha->toPng();

To check captcha use:

<?php

    use Zablose\Captcha\Captcha;

    // ...

    Captcha::verify('captcha', 'hash');

Feel the joy and happiness!

Development

Check submodule readme for more details about development environment used.

Hosts

Append to /etc/hosts.

127.0.0.26       captcha.zdev

Quick Start

$ git clone -b 'dev' --single-branch --depth 1 https://github.com/zablose/captcha.git captcha
$ cd captcha
$ git submodule update --init

# Copy env file, then ammend it to your needs.
$ cp .env.example .env

$ docker compose up -d

# To "enter" container, using Bash shell.
$ docker exec -u debian -it captcha-php-fpm bash

(captcha-php-fpm)$ phpunit

统计信息

  • 总下载量: 7.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-09-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固