Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grena/oxatis-api-php-client
PHP client for Oxatis SOAP API
https://github.com/grena/oxatis-api-php-client
Last synced: about 1 month ago
JSON representation
PHP client for Oxatis SOAP API
- Host: GitHub
- URL: https://github.com/grena/oxatis-api-php-client
- Owner: grena
- Created: 2021-06-22T09:49:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T08:40:25.000Z (over 1 year ago)
- Last Synced: 2024-12-19T19:56:29.784Z (about 1 month ago)
- Language: PHP
- Homepage:
- Size: 620 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Oxatis API - PHP Client
This is a PHP API Client for any [Oxatis](https://www.oxatis.com/) SaaS instance.
[![Build Status](https://travis-ci.com/grena/oxatis-api-php-client.svg?branch=main)](https://travis-ci.com/grena/oxatis-api-php-client)
## Requirements
- PHP >= 7.4
- Composer## Install
```bash
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:
```php
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:
```php
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:
```bash
docker-compose run php_74 php generate-soap-api.php
```This will:
- Generate the needed config files for `phpro/soap-client` in the `config/` 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:
```bash
cp docker-compose.yml.dist docker-compose.yml
docker-compose up --build
docker-compose run php_74 ./composer.phar install
```