krencl / wedos-api
There is no license information available for the latest version (1.0.3) of this package.
Wedos API client for PHP
1.0.3
2019-07-19 17:39 UTC
Requires
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^7.3
This package is auto-updated.
Last update: 2025-03-20 06:25:30 UTC
README
PHP API client for communication with Wedos API.
Installation
composer require krencl/wedos-api
Usage
Configuration
From JSON file, in root path is sample file config.json.dist
:
<?php use Krencl\WedosApi\Configuration; $configuration = Configuration::createFromFile(__DIR__ . '/config.json');
Or hardcoded:
<?php use Krencl\WedosApi\Configuration; $configuration = new Configuration('user', 'password'); // optional $configuration->setTestingMode(true); $configuration->setUrl('https://...');
Request
Using built-in command:
<?php use Krencl\WedosApi\Command; use Krencl\WedosApi\Constants; /** @var \Krencl\WedosApi\Request $command */ $command = new Command\DomainsList(Constants\DomainStatus::ACTIVE);
Or create custom request:
<?php use Krencl\WedosApi\Request; use Krencl\WedosApi\Constants; $request = new Request('domains-list', [ 'status' => Constants\DomainStatus::ACTIVE, ]);
Example
<?php use Krencl\WedosApi\Client; use Krencl\WedosApi\Configuration; use Krencl\WedosApi\Command; use Krencl\WedosApi\Constants; use Krencl\WedosApi\Exception\ResponseException; $configuration = Configuration::createFromFile(__DIR__ . '/../config.json.dist'); $client = new Client($configuration); $clTRID = 'myCustomId-1'; $command = new Command\DomainsList(Constants\DomainStatus::ACTIVE, $clTRID); try { $response = $client->sendRequest($command); var_dump($response->getData()); } catch (ResponseException $e) { echo (string) $e; var_dump($e->getResponse()->getCurlResult()); }