1. Description
Officially given the SDK call method too wasted development time, I wrote a call very simple a geetest package as far as possible to reduce the development time, if you think the official given the SDK is good enough, can not be used.
2. Installation
- Composer require laraveler/geetest
- Add Geetest\provider\geetestserviceprovider::class to the providers array in config/app.php
- Execute PHP Artisan vendor:publish
3. Call
- Use Geetest\facades\geetest
- Return Geetest::init ($request, function () {auth::attempt ([...])},function () {...});
The $request object needs to be injected during initialization, the second parameter is the action to be done after validation succeeds, and the third parameter is the action required to validate the failure
Note: The method that calls Geetest must be registered as any in routes
Config in laravel config directory (geetest.php)
"Api_url" = "http://api.geetest.com/register.php?gt={id}&user_id={user_id}"
The {ID} here is parsed to automatically get the ID option in config, as well as user_id.