thelia/api-client

This package is abandoned and no longer maintained. No replacement package was suggested.

A php client for Thelia API

2.0.0 2023-07-25 14:56 UTC

This package is auto-updated.

Last update: 2023-07-25 15:06:56 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