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

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

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

closca/captcha

Composer 安装命令:

composer require closca/captcha

包简介

Captcha Package for Laravel 4

README 文档

README

A simple Laravel 4 service provider for including the Captcha for Laravel 4.

Preview

Preview

Installation

The Captcha Service Provider can be installed via Composer by requiring the mews/captcha package and setting the minimum-stability to dev (required for Laravel 4) in your project's composer.json.

{
    "require": {
        "laravel/framework": "4.1.*",
        "mews/captcha": "dev-master-l4"
    },
    "minimum-stability": "dev"
}

###Updated Installation

The improvements of mauris's fork over mewebstudio are listed on the pull request.

In order to use mauris's fork, the repository meeds to be added into the composer.json in the following manner:

{
    "require": {
        "laravel/framework": "4.1.*",
        "mews/captcha": "1.0.*"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/mauris/captcha"
        }
    ]
}

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 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 app/config/app.php and register the Captcha Service Provider.

    'providers' => array(
        // ...
        'Mews\Captcha\CaptchaServiceProvider',
    )

Find the aliases key in app/config/app.php.

    'aliases' => array(
        // ...
        'Captcha' => 'Mews\Captcha\Facades\Captcha',
    )

Configuration

To use your own settings, publish config.

$ php artisan config:publish mews/captcha

Example Usage

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

    Route::any('/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(Captcha::img(), 'Captcha image') . '</p>';
        $content .= '<p>' . Form::text('captcha') . '</p>';
        $content .= '<p>' . Form::submit('Check') . '</p>';
        $content .= '<p>' . Form::close() . '</p>';
        return $content;

    });

^_^

Links

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-07