Download the PHP package bhekor/laravel-geetest without Composer

On this page you can find all versions of the php package bhekor/laravel-geetest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-geetest

Laravel Geetest

Build Status DUB Support Release

A Laravel package for Geetest platform developed by Bhekor. It provides simple usage for laravel of Geetest.

Geetest Demo: Geetest

Installation

Laravel 7 or later is required.

This Package now supports Geetest 3.0.

To get the latest version of Laravel Geetest, simply require the project using Composer:

Or you can add following to require key in composer.json:

then run:

You don't have to go through these next steps, but incase.

Next, You should need to register the service provider. Open up config/app.php and add following into the providers key:

And you can register the Geetest Facade in the aliases of config/app.php :

Configuration

To get started, you need to publish vendor assets using the following command:

This will create a config file named config/geetest.php which you can configure geetest as you like.

It will also generate a views folder named resources/views/vendor/geetest, there will be a view file named geetest.blade.php. Here you can configure styles of geetest. For example, you can change the script alert() as you like.

Usage

Firstly, You need to register in Geetest. Creating an app and get ID and KEY.

For example. You can see app ID and KEY after you added an app in Geetest Admin Page

Then configure them in your .env file because you'd better not make them public.

Add them to .env as follows:

Then, You can use render() in views like following, It will render a geetest code captcha:

For example, you can use it in form like this:

It will render like this:

When you click the submit button, it will verify the Geetest Code. If you didn't complete the validation, it will alert some text and prevent the form from submitting.

Or you can set other style of Geetest:

Then it will be embed or popup style in the website. Default to float.

If the validation is completed, the form will be submitted successfully.

Server Validation

What's the reason that Geetest is safe? If it only has client validation of frontend, can we say it is complete? It also has server validation to ensure that the post request is validate.

First I have to say that you can only use Geetest of Frontend. But you can also do simple things to achieve server validation.

You can use $this->validate() method to achieve server validation. Here is an example:

If we use Geetest, the form will post three extra parameters geetest_challenge geetest_validate geetest_seccode. Geetest use these three parameters to achieve server validation.

If you use ORM, we don't need to add these keys to Model, so you should add following in Model:

You can define alert text by altering server_fail_alert in config/geetest.php

Also you can use Request to achieve validation:

We can use it in our Controller by Request parameter:

Options

Change Ajax Url

If you want to change the Geetest Ajax Url, you can configure it in config/geetest.php, change url as you like, but at this time you need to add extra routes in your routes.php (Laravel 5.2 or former ) or routes/web.php (Laravel 5.3 or later). And you need to add a triat in your controller.

For example, If you add this route:

you need to add Bhekor\LaravelGeetest\GeetestCaptcha in your AuthController:

Then an Ajax url is configured successfully.

Also you can use this Trait in other Controller but you need to configure url in config/geetest.php.

Configure Url while rendering

Also, you can set Geetest Ajax Url by following way:

By setGeetestUrl method you can set Geetest Ajax Url. If it is configured, it will override url configured in config/geetest.php.

Configure Alert Message

You can configure alert message by configure client_fail_alert and server_fail_alert in config/geetest.php.

Configure Language

Geetest supports different language:

You can configure it in config/geetest.php .

Here are key-values of Languge Configuration:

for example, If you want to use Korean, just change lang key to ko:

Configure Protocol

You can configure protocol in config/geetest.php .

for example, If you want to use https, just change protocol key to https:

Configure Default Product

You can configure default product in config/geetest.php .

for example, If you want to use popup product, just change product key to popup:

Mind that it only works when you use like this:

If you use like this:

It will override the configuration in config/geetest.php.

Contribution

If you find something wrong with this package, you can send an email to [email protected]

Or just send a pull request to this repository.

Pull Requests are really welcomed.

Author

Ibidapo Adeolu (Bhekor) , from Nigeria

License

Laravel Geetest is licensed under The MIT License (MIT).


All versions of laravel-geetest with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
illuminate/support Version >=7.0
illuminate/routing Version >=7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bhekor/laravel-geetest contains the following files

Loading the files please wait ....