饿了么 SDK
composer require laraver/eleme-sdk:dev-master
$eleme = new Eleme([
'app_id' => '',
'secret' => '',
'debug' => true,
'log' => [
'file' => storage_path('logs/eleme.log'),
'level' => 'debug',
'permission' => 0777,
]
]);
$url = $eleme->oauth->pre_auth->request($callbackUrl)->getTargetUrl();
$accessToken = $eleme->oauth->getToken();
$eleme = $eleme->oauth->createAuthorizerApplication($accessToken['access_token']);
// 获取门店信息
$response = $eleme->user->getUser();
$eleme = $eleme->oauth->createAuthorizerApplication($access_token);
// 订单实例
$order = $eleme->order;
PS: 其他请参考 https://github.com/hanson/eleme-sdk/blob/master/src/Eleme.php 中的备注
$response = $eleme->server->serve();
if (!$response) {
return;
}
$message = json_decode($response['message'], true);
if ($response['type'] == 10) { // 订单生效
}
# elseif(...)