承接 sellerlabs/slapi-php 相关项目开发

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

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

sellerlabs/slapi-php

Composer 安装命令:

composer require sellerlabs/slapi-php

包简介

PHP client for SellerLabs' API

README 文档

README

This is a PHP client library for SellerLabs' API (SLAPI)

Requirements:

  • Composer and autoload.php
  • Credentials to the Seller Labs API

Documentation

  • API documentation for the Seller Labs API is available at: https://docs.sellerlabs.com/
  • Documentation for the library is available under docs/api in this repo

How to install:

First, add the package to your composer.json:

    // ...
    "require": {
        "sellerlabs/slapi-php": "*"
    }
    // ...

Then run composer update

How to use with Laravel 5:

First you need to configure the client inside your app service provider:

public function register()
{
    $this->app->bind(
        'SellerLabs\Slapi\Interfaces\SlapiClientInterface',
        function () {
            return new SlapiClient(
                'YourSlapiToken',
                'https://api.sellerlabs.com'
            );
        }
    );
}

Then inside any of your controllers, you can inject the dependency through the constructor:

// ...
class OrdersController extends Controller
{
    /**
     * Implementation of a client for SellerLabs' research API
     *
     * @var \SellerLabs\Slapi\Interfaces\SlapiClientInterface
     */
    protected $slapiClient;

    /**
     * Construct an instance of a ProductsController
     */
    public function __construct(SlapiClientInterface $slapiClient)
    {
        $this->slapiClient = $slapiClient;
    }

    /**
     * Handle GET /v1/orders/
     */
    public function getOrders($args)
    {
        return $this->slapiClient->request('/v1/orders', $args);
    }
}

Laravel's container is smart enough to automatically perform dependency injection, which adds the client parameter for you when initializing your controller's class

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-30