2017 © Pedro PelĂĄez
 

library webshop-client

Textalk Webshop API-client

image

textalk/webshop-client

Textalk Webshop API-client

  • Tuesday, July 12, 2016
  • by fiddur
  • Repository
  • 11 Watchers
  • 2 Stars
  • 4,695 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 17 Versions
  • 1 % Grown

The README.md

Abicart (Textalk Webshop) API-client

Build Status Coverage Status, (*1)

A library to simplify API-usage on Abicart API., (*2)

Examples:

To get the name in Swedish (sv) of the first 2 articlegroups on the Demoshop, you could do:, (*3)

<?php

require(dirname(dirname(__FILE__)) . '/vendor/autoload.php');

use Textalk\WebshopClient\Connection;

$api = Connection::getInstance('default', array('webshop' => 22222));

var_dump(
  $api->Articlegroup->list(
    array("name" => "sv", "uid" => true),
    array("limit" => 2)
  )
);

// Will produce:
// array(2) {
//   [0] =>
//   array(2) {
//     'name' =>
//     array(1) {
//       'sv' =>
//       string(4) "Herr"
//     }
//     'uid' =>
//     int(1347891)
//   }
//   [1] =>
//   array(2) {
//     'name' =>
//     array(1) {
//       'sv' =>
//       string(3) "Dam"
//     }
//     'uid' =>
//     int(1347897)
//   }
// }

You can save a handle to the API for a specific instance:, (*4)

$api = Connection::getInstance('default', array('webshop' => 22222));

// Save a handle to the API for a single Articlegroup:
$articlegroup = $api->Articlegroup(1347891);

// Get all names:
// These are all equivalent:
//
//  * $api->Articlegroup(1347891)->get('name')
//  * $api->Articlegroup->get(1347891, 'name')
//  * $api->call('Articlegroup.get', array(1347891, 'name'))
var_dump(
  $articlegroup->get('name')
);

// Will produce:
// array(1) {
//   'name' =>
//   array(2) {
//     'en' =>
//     string(3) "Men"
//     'sv' =>
//     string(4) "Herr"
//   }
// }

If you mess up, you will get specific exceptions and see the actual request:, (*5)

// This line won't actually DO anything, so it won't crasch:
$scissor = $api->IDontKnow("What I'm doing");

// But this will:
$scissor->run();

// -->
// PHP Fatal error:  Uncaught exception 'Textalk\WebshopClient\Exception\MethodNotFound' with message 'IDontKnow.run: Method not found: No API for IDontKnow
// On request: {"jsonrpc":"2.0","method":"IDontKnow.run","id":"7089b561-9252-4a0a-b45b-15a873509571","params":["What I'm doing"]}' in /home/liljegren/textalk-webshopclient-php/lib/Exception.php:32

Named Connections

Normally, you only want ONE connection in your application. You can use Connection::getInstance() and get the same Connection every time., (*6)

You can let the Connection-class hold named instances by using Connection::getInstance('name') with different contexts (or even different backend URLs). E.g.:, (*7)

$admin_connection = Connection::getInstance('admin', array('auth' => $auth_token));

... elsewhere in the code you can get the connection with:, (*8)

$admin_connection = Connection::getInstance('admin');

Installing

Preferred way to install is with Composer., (*9)

Just add, (*10)

"require": {
  "textalk/webshop-client": "0.3.*"
}

in your projects composer.json., (*11)

Changelog

0.3.0, (*12)

  • Adding support for php ^7.2 and php ^8.0 versions
  • Dropping support for older php versions

0.2.6, (*13)

  • Adding support for http(s) connections (wss as default)

0.2.1, (*14)

  • Using tivoka 3.4.*, avoiding stability-level dev for dependencies.

0.2.0, (*15)

  • Explicitly always using WebSocket connection.
  • Adding possibility to set options for connection, like headers and timeout.
  • Removed case-juggling in class name magic; use correct casing!

The Versions

12/07 2016

dev-master

9999999-dev

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren
by Sören Jensen

12/07 2016

0.2.6

0.2.6.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren
by Sören Jensen

06/07 2016

0.2.5

0.2.5.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren
by Sören Jensen

24/09 2015

0.2.4

0.2.4.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

01/03 2015

0.2.3

0.2.3.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

10/02 2015

0.2.2

0.2.2.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

31/10 2014

0.2.1

0.2.1.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

29/10 2014

dev-dev-updating-examples

dev-dev-updating-examples

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

29/10 2014

0.2.0

0.2.0.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

28/10 2014

0.1.5

0.1.5.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

28/10 2014

dev-dev-exception-message

dev-dev-exception-message

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

21/10 2014

0.1.4

0.1.4.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

27/08 2014

0.1.3

0.1.3.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

26/08 2014

dev-dev-getSession

dev-dev-getSession

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

07/07 2014

0.1.2

0.1.2.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

30/06 2014

0.1.1

0.1.1.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren

09/06 2014

0.1.0

0.1.0.0

Textalk Webshop API-client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fredrik Liljegren