承接 developer-tz/simple-captcha 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

developer-tz/simple-captcha

Composer 安装命令:

composer require developer-tz/simple-captcha

包简介

Simple Captcha Service Provider for laravel 5

README 文档

README

A simple Laravel 5 package for including the Simple Captcha for Laravel 5.

Installation

The Simple Captcha Service Provider can be installed via Composer by requiring the developer-tz/simple-captcha package and setting the minimum-stability to dev in your project's composer.json.

{
    "require": {
        "laravel/framework": "5.*",
        "developer-tz/simple-captcha": "dev-master"
    },
    "minimum-stability": "dev"
}

Update your packages with composer update or install with composer install.

In Windows, you'll need to include the GD2 DLL php_gd2.dll as an extension in php.ini.

Usage

To use the Simple Captcha Service Provider, you must register the provider when bootstrapping your Laravel application. There are essentially two ways to do this.

Find the providers key in config/app.php and register the Simple Captcha Service Provider.

    'providers' => array(
        // ...
        'DeveloperTz\SimpleCaptcha\SimpleCaptchaServiceProvider',
    )

Find the aliases key in config/app.php.

    'aliases' => array(
        // ...
        'SimpleCaptcha'      => 'DeveloperTz\SimpleCaptcha\Facades\SimpleCaptcha',
    )

Configuration

To use your own settings, publish config.

$ php artisan vendor:publish

Example Usage

    // [your site path]/app/routes.php

    Route::any('/simple-captcha-test', function()
    {

        if (Request::getMethod() == 'POST')
        {
            $rules =  array('captcha' => array('required', 'captcha'));
            $validator = Validator::make(Input::all(), $rules);
            if ($validator->fails())
            {
                echo '<p style="color: #ff0000;">Incorrect!</p>';
            }
            else
            {
                echo '<p style="color: #00ff30;">Matched :)</p>';
            }
        }

        $content = Form::open(array(URL::to(Request::segment(1))));
        $content .= '<p>' . HTML::image(SimpleCaptcha::img(), 'Captcha image') . '</p>';
        $content .= '<p>' . Form::text('captcha') . '</p>';
        $content .= '<p>' . Form::submit('Check') . '</p>';
        $content .= '<p>' . Form::close() . '</p>';
        return $content;

    });

^_^

Links

Captcha package for earlier versions,

统计信息

  • 总下载量: 617
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 19
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 19
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-05