sellerlabs / slapi-php
This package is abandoned and no longer maintained.
No replacement package was suggested.
PHP client for SellerLabs' API
dev-master
2015-05-29 12:22 UTC
Requires
- guzzlehttp/guzzle: 4.1.*
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: *
- sami/sami: ~3.0
This package is not auto-updated.
Last update: 2020-01-28 10:48:27 UTC
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