PHP code example of laraver / eleme-sdk

1. Go to this page and download the library: Download laraver/eleme-sdk 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/ */

    

laraver / eleme-sdk example snippets



$eleme = new Eleme([
    'app_id' => '',
    'secret' => '',
    'debug'  => true,
    'log' => [
        'file' => storage_path('logs/eleme.log'),
        'level'      => 'debug',
        'permission' => 0777,
    ]
]);

$accessToken = $eleme->oauth->getToken();

$eleme = $eleme->oauth->createAuthorizerApplication($accessToken['access_token']);

// 获取门店信息
$response = $eleme->user->getUser();

$response = $eleme->server->serve();

if (!$response) {
    return;
}

$message = json_decode($response['message'], true);

if ($response['type'] == 10) { // 订单生效

} 
# elseif(...)