承接 sportmaster/api-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sportmaster/api-client

Composer 安装命令:

composer require sportmaster/api-client

包简介

A flexible and extensible PHP client for the Sportmaster Seller API

README 文档

README

A flexible and extensible PHP client for interacting with the Sportmaster Seller API. This package supports both native PHP and frameworks like Laravel, with easy configuration, token management, and logging.

Installation

Install the package via Composer:

composer require sportmaster/api-client

Usage

Basic Example (Native PHP)

use Sportmaster\Api\Client;
use Sportmaster\Api\Endpoints\AuthClient;
use Sportmaster\Api\Request\AuthRequest;

$client = new Client();
$authClient = new AuthClient($client);

$request = new AuthRequest('your_client_id', 'your_client_secret');
$response = $authClient->authenticate($request);

echo $response->getAccessToken(); // Outputs the access token

Laravel Integration

Add the service provider to config/app.php:

'providers' => [
    Sportmaster\Api\Laravel\SportmasterApiServiceProvider::class,
]

Use the client in your application:

use Sportmaster\Api\Endpoints\AuthClient;
use Sportmaster\Api\Request\AuthRequest;

$client = app(\Sportmaster\Api\Client::class);
$authClient = new AuthClient($client);

$request = new AuthRequest('your_client_id', 'your_client_secret');
$response = $authClient->authenticate($request);

echo $response->getAccessToken();

Configuration

  • Token Storage: By default, tokens are stored in a JSON file (.sportmaster_token.json). You can implement TokenStorageInterface for custom storage.
  • Logger: By default, logs are written to sportmaster_api.log. Implement LoggerInterface for custom logging.
  • HTTP Client: Uses Guzzle by default. Pass a custom ClientInterface to the Client constructor for alternative HTTP clients.

Requirements

  • PHP ^8.1
  • Guzzle HTTP Client ^7.5
  • Monolog ^3.0

Testing

Run tests with PHPUnit:

composer test

Documentation

Detailed documentation for each class is available in the docs/ directory.

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-08