LaravelChen / laravel-geetest by LaravelChen

laravel-geetest
417
18
2
Package Data
Maintainer Username: LaravelChen
Maintainer Contact: 848407695@qq.com (LaravelChen)
Package Create Date: 2017-04-16
Package Last Update: 2017-04-16
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-19 03:19:38
Package Statistics
Total Downloads: 417
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 18
Total Watchers: 2
Total Forks: 5
Total Open Issues: 1

Laravel-Geetest For Laravel5

采用了Germeyd的package,在此基础上增加了官方version3.0的使用

效果图

Version3.0

image

Version2.0

image

安装

composer安装package

composer require laravelchen/laravel-geetest

配置

在config目录的app文件下增加如下:

'providers' => [
       LaravelChen\Geetest\GeetestServiceProvider::class,
   ];
'aliases'=>[
      'Geetest' => LaravelChen\Geetest\Geetest::class,
]

在env文件里面增加如下:

GEETEST_ID=ID57cfd6d22b89xxxxxxxd1824ce94a2
GEETEST_KEY=8214f76999114xxxxxxxx2923c42b31

生成配置文件

会在config目录下生成geetest配置文件,同时在resources目录下生成视图文件

php artisan vendor:publish

用法

直接在form表单中加入{!! Geetest::render() !!}

具体如下:

<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="//cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
    <title>Laravel</title>
</head>
<body style="margin-top: 200px">
<div class="col-md-4 col-md-offset-4">
    <form action="/" method="post">
        <div class="form-group">
            <label for="name" class="control-label">User:</label>
            <input id="name" name="name" type="text" class="form-control">
        </div>
        {!! Geetest::render() !!}
        <br>
        <button type="submit" class="btn btn-success form-control">提交</button>
    </form>
</div>
</body>
</html>