2017 © Pedro Peláez
 

library ls-retail-guzzle

A Guzzle HTTP Client extension for Lightspeed Retail.

image

lightspeedhq/ls-retail-guzzle

A Guzzle HTTP Client extension for Lightspeed Retail.

  • Friday, September 29, 2017
  • by jamesratcliffe
  • Repository
  • 1 Watchers
  • 1 Stars
  • 54 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 42 % Grown

The README.md

RetailClient for Lightspeed Retail

The class is an extension of the Guzzle 6 PHP HTTP Client for use with the Lightspeed Retail API., (*1)

It works the same way as the standard Guzzle Client, but takes care of refreshing access tokens and rate limiting., (*2)

This package was created for demonstration purposes and comes with no waranty., (*3)

Installation

Use this commmand to install with Composer:, (*4)

$ composer require lightspeedhq/ls-retail-guzzle:~1.0

Alternatively, you can add these lines to your composer.json file:, (*5)

    "require": {
        "lightspeedhq/ls-retail-guzzle": "~1.0"
    }

Usage Example

<?php
require 'vendor/autoload.php';
use LightspeedHQ\Retail\RetailClient;

// Replace these with your own values for testing.
// API tokens and client credentials should not be stored in your code!
$account_id = XXXXX;
$refresh_token = '****';
$client_id = '****';
$client_secret = '****';

$client = new RetailClient($account_id, $refresh_token, $client_id, $client_secret);

// GET request with some URL paramters. We'll get the first ItemShop
// from this item and dump it.
$query = [
    'load_relations' => '["ItemShops"]',
    'description' => '~,%test%',
    'limit' => 1
];
$response = $client->get('Item', ['query' => $query]);
$items = json_decode($response->getBody(), true)['Item'];
echo '

GET Test

'; echo '
';
var_dump($items['ItemShops']['ItemShop'][0])
echo '
' // POST request to create an Item $payload = [ 'description' => 'Rest Test', 'Prices' => [ 'ItemPrice' => [ 'amount' => 100, 'useType' => 'Default' ] ] ]; $response = $client->post('Item', ['json' => $payload]); echo '

POST Test

'; echo '
';
var_dump(json_decode($response->getBody(), true));
echo '
';

The Versions

29/09 2017

dev-master

9999999-dev https://github.com/jamesratcliffe/ls-retail-guzzle

A Guzzle HTTP Client extension for Lightspeed Retail.

  Sources   Download

MIT

The Requires

 

by Michael Carey
by James Ratcliffe

api rest guzzle pos retail lightspeed

29/09 2017

v1.0

1.0.0.0 https://github.com/jamesratcliffe/ls-retail-guzzle

A Guzzle HTTP Client extension for Lightspeed Retail.

  Sources   Download

MIT

The Requires

 

by Michael Carey
by James Ratcliffe

api rest guzzle pos retail lightspeed