grena / oxatis-api-php-client
Oxatis client for the API
v1.0.0
2021-06-24 10:19 UTC
Requires
- php: >=7.1
- goetas-webservices/xsd2php-runtime: v0.2.15
- jms/serializer: ^3.12
- php-http/client-common: ^2.1
- php-http/discovery: ^1.7
- php-http/httplug: ^2.1
- php-http/message: ^1.8
- php-http/message-factory: ^1.0
- php-http/multipart-stream-builder: ^1.0
- phpro/soap-client: ^1.6
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
- psr/http-message-implementation: ^1.0
Requires (Dev)
- donatj/mock-webserver: ^2.0
- friendsofphp/php-cs-fixer: ^2.14
- goetas-webservices/xsd2php: 0.4.3
- http-interop/http-factory-guzzle: ^1.0
- laminas/laminas-code: ^3.1.0
- php-http/guzzle6-adapter: ^2.0
- phpspec/phpspec: ^7.1.0
- phpunit/phpunit: ^9.5.5
- symfony/yaml: ^4.2
Suggests
- php-http/guzzle6-adapter: In order to use Guzzle v6 as the HTTP client
This package is auto-updated.
Last update: 2024-11-19 11:12:33 UTC
README
This is a PHP API Client for any Oxatis SaaS instance.
Requirements
- PHP >= 7.4
- Composer
Install
composer require grena/oxatis-api-php-client
How to use
In your project, import the OxatisClientBuilder
and build a client with your Oxatis AppID and token:
use Heavymind\Oxatis\ApiClient\OxatisClientBuilder; // Build the Oxatis client with your AppID and Token $clientBuilder = new OxatisClientBuilder(); $oxatisClient = $clientBuilder->buildAuthenticatedByToken( "OXATIS_APP_ID", "OXATIS_TOKEN" );
Now you can use the OxatisClient
to make requests, for example here, retrieving "Country names" for each tax rate:
use Heavymind\Oxatis\ApiClient\Type\TaxRateGetList; use Heavymind\Oxatis\ApiClient\Type\TaxRateEntity; $response = $oxatisClient->getTaxRateServices()->taxRateGetList( new TaxRateGetList($oxatisClient->getWSIdentitySoap()) ); foreach ($response->getDataResultService()->getData()->getTaxRateList()->getTaxRateIDs() as $taxRateID) { /** @var TaxRateEntity $taxRateID */ var_dump($taxRateID->getCountryName()); }
Regenerate the API
This API is mainly auto-generated thanks to phpro/soap-client
.
If the online Soap WSDL files changed on Oxatis side, this API Client needs to be regenerated by running:
docker-compose run php_74 php generate-soap-api.php
This will:
- Generate the needed config files for
phpro/soap-client
in theconfig/
folder - Generate each Type class for each service in
src/Type
- Generate client and client factory for each service in
src/Services/
Contribute
Clone this project, then:
cp docker-compose.yml.dist docker-compose.yml docker-compose up --build docker-compose run php_74 ./composer.phar install