thelia/api-client

Guzzle based client for Thelia API

1.0.0 2014-12-03 20:18 UTC

This package is auto-updated.

Last update: 2022-05-14 16:46:46 UTC


README

What is this ?

This is a PHP client for Thelia API.

How to use it ?

First, add thelia/api-client to your composer.json

{
    "require": {
        # ...
        "thelia/api-client": "~1.0"
    }
}

Then, create an instance of Thelia\Api\Client\Client with the following parameters:

$client = new Thelia\Api\Client\Client("my api token", "my api key", "http://mysite.tld");

You can access to your resources by using the 'do*' methods

<?php
list($status, $data) = $client->doList("products");
list($status, $data) = $client->doGet("products/1/image", 1);
list($status, $data) = $client->doPost("products", ["myData"]);
list($status, $data) = $client->doPut("products", ["myData"]);
list($status, $data) = $client->doDelete("products", 1);

Or you can use magic methods that are composed like that: methodEntity

<?php
list($status, $data) = $client->listProducts();
list($status, $data) = $client->getTaxes(42);
list($status, $data) = $client->postPse($data);
list($status, $data) = $client->putTaxRules($data);
list($status, $data) = $client->deleteAttributeAvs(42);

Tests

To run the tests, edit the file tests/server.txt and place your thelia address