承接 simplesquid/vend-sdk 相关项目开发

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

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

simplesquid/vend-sdk

Composer 安装命令:

composer require simplesquid/vend-sdk

包简介

An unoffical PHP SDK for Vend POS

README 文档

README

Latest Version on Packagist Build Status MIT License Total Downloads

An unofficial PHP SDK for the Vend POS API.

Installation

You can install this package via composer:

composer require simplesquid/vend-sdk

Setup

To setup, get the instance of the SDK and set the desired user agent and settings:

$vend = Vend::getInstance();

/* Optional configuration. */
$vend->userAgent('Vend SDK')
     ->requestTimeout(2)
     ->confirmationTimeout(30);

It is advisable that you use the client object as a singleton, however, there is no explicit restriction for this.

Usage

This outlines a typical sequence of instructions, but is not a complete list of all the functionality of the SDK. Please review the code for more advanced usages. It is also suggested you read the Vend API documentation.

Alternatively, you can see a working authorisation implementation in our Laravel Vend SDK package.

Authorisation

You have two options for authorisation with the Vend API, a Personal Access Token or OAuth 2.0.

Personal Access Token

When using the Personal Access Token, simply setup the Vend client like so:

$vend->domainPrefix($domain_prefix)
     ->personalAccessToken($access_token);

OAuth 2.0

Setup the Vend client with the OAuth identifiers:

$vend->clientId($client_id)
     ->clientSecret($client_secret)
     ->redirectUri($redirect);
Initial authorisation procedure

Send the user to the OAuth URL generated by:

$vend->getAuthorisationUrl($previous_url);

Use the domain prefix and authorisation code returned from the OAuth process:

/** @var \SimpleSquid\Vend\Resources\OneDotZero\Token */
$token = $vend->domainPrefix($domain_prefix)
              ->oAuthAuthorisationCode($code);

Make sure you store the returned Token object and the domain prefix.

Subsequent setup procedure

Once you have received the initial authorisation, you may setup the Vend client using the Token object received during the authorisation process:

$vend->authorisationToken($token);

If a request throws a \SimpleSquid\Vend\Exceptions\TokenExpiredException, you can refresh the token like so:

/** @var \SimpleSquid\Vend\Resources\OneDotZero\Token */
$token = $vend->refreshOAuthAuthorisationToken();

Again, make sure you store the returned Token object.

Requests

To see all the available requests, take a look at traits located in the Actions folder. As an example, Products can be managed using the following requests:

/**
 * List products.
 * Returns a paginated list of products.
 *
 * @param  int|null   $page_size  The maximum number of items to be returned in the response.
 * @param  int|null   $after      The lower limit for the version numbers to be included in the response.
 * @param  int|null   $before     The upper limit for the version numbers to be included in the response.
 * @param  bool|null  $deleted    Indicates whether deleted items should be included in the response.
 *
 * @return \SimpleSquid\Vend\Resources\TwoDotZero\ProductCollection
 */
$products = $vend->product->get($page_size, $after, $before, $deleted);
/**
 * Get a single product.
 * Returns a single product object with a given ID.
 *
 * @param  string  $id  Valid product ID.
 *
 * @return \SimpleSquid\Vend\Resources\TwoDotZero\Product
 */
$product = $vend->product->find($id);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email security@simplesquid.co.za instead of using the issue tracker.

Credits

Package skeleton based on spatie/skeleton-php.

About us

SimpleSquid is a small web development and design company based in Cape Town, South Africa.

License

The MIT License (MIT). Please see License File for more information.

simplesquid/vend-sdk 适用场景与选型建议

simplesquid/vend-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.66k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2019 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sdk」 「vend」 「point-of-sale」 「simplesquid」 「vend-sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 simplesquid/vend-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 simplesquid/vend-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 simplesquid/vend-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-30