laraver / eleme-sdk
饿了么 SDK
Installs: 2 542
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 5
Forks: 11
Open Issues: 1
Requires
- hanson/foundation-sdk: ^3.0
This package is not auto-updated.
Last update: 2024-10-27 05:09:45 UTC
README
饿了么 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(...)