thelia / api-client
A php client for Thelia API
Installs: 83 500
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 5
Forks: 6
Open Issues: 2
Requires
- php: >=8.1
- psr/http-client: ^1.0
- symfony/http-client: ^6.3
Requires (Dev)
- phpunit/phpunit: ^10.2
- symfony/dotenv: ^6.3
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