shipdeo/api

Shipdeo API 包

v1.0.2 2024-06-13 08:41 UTC

This package is auto-updated.

Last update: 2024-09-13 09:32:28 UTC


README

Shipdeo API 包。

1. 安装

您可以通过 composer 安装此包

composer require shipdeo/api

2. 配置

将以下环境变量添加到您的 .env 文件中

SHIPDEO_CLIENT_ID=your-client-id
SHIPDEO_CLIENT_SECRET=your-client-secret
SHIPDEO_PLATFORM=your-platform
SHIPDEO_AUTH_URL=https://auth-api-development.shipdeo.com/oauth2/connect/token

3. 使用

身份验证

use Shipdeo\Facades\Shipdeo;

$authService = app('shipdeo.auth');
$response = $authService->authenticate(
    config('shipdeo.auth.client_id'),
    config('shipdeo.auth.client_secret'),
    'your-username',
    'your-password',
    config('shipdeo.auth.platform')
);

echo $response['accessToken'];

步骤 4: 自动加载依赖项

确保更新您的 composer.json 以包括必要的依赖项

"require": {
    "php": ">=7.4",
    "guzzlehttp/guzzle": "^7.0"
}

运行 composer update 以安装新的依赖项。