定制 adbros/shoptet-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

adbros/shoptet-sdk

最新稳定版本:v0.8.5

Composer 安装命令:

composer require adbros/shoptet-sdk

包简介

Shoptet API SDK

README 文档

README

main workflow Licence Downloads this Month Downloads total Latest stable

Installation

composer require adbros/shoptet-sdk

Usage

<?php declare(strict_types = 1);

use Adbros\Shoptet\OAuth;
use Adbros\Shoptet\Sdk;

// Initialize OAuth
$oAuth = new OAuth(
	clientId: getenv('CLIENT_ID'),
	clientSecret: getenv('CLIENT_SECRET'),
	eshopUrl: getenv('ESHOP_URL'),
);

// Get oAuthAccessToken in installation process
$oAuthAccessToken = $oAuth->getOAuthAccessToken(
	code: $_GET['code'],
	redirectUri: 'https://example.com/install',
);

// Get apiAccessToken before API call
$apiAccessToken = $oAuth->getApiAccessToken(
	oAuthAccessToken: $oAuthAccessToken->accessToken,
);

// Initialize SDK
$sdk = new Sdk(
	apiAccessToken: $apiAccessToken->accessToken,
);

// Get customers
$page = 1;

do {
	$customers = $sdk->getCustomers($page);
	
	foreach ($customers->customers as $customer) {
		// Get customer
		$customerDetail = $sdk->getCustomer($customer->guid);
	}
} while ($page++ < $customers->paginator->pageCount);

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-22