1. Go to this page and download the library: Download luanjinlong/youzan library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
luanjinlong / youzan example snippets
`
namespace App\Http\Controllers;
use Long\Youzan\RequestMethod\Users;
class UsersController extends Controller
{
/**
* @param Users $users
*/
public function index(Users $users)
{
$response = $users->getUsersWeixinFollowerSearch('2018-09-10','2018-09-11',10);
dd($response);
}
}
`
1. app('youzan')
2. app(Client::class)
3. 或者直接在控制器里面依赖注入 Long\Youzan\Open\Client
namespace App\Http\Controllers;
use Long\Youzan\Open\Client;
class TestController extends Controller
{
/**
* @param Client $client
*/
public function index(Client $client)
{
$token = $client->getAccessToken();
dd($token);
}
}