Search by

wildix / s2s-client-php

wildix_srl

php sdk wildix

Package info

github.com/Wildix/s2s-client-php

Homepage

pkg:composer/wildix/s2s-client-php

Statistics

Installs: 15 140

Dependents: 1

Suggesters: 0

Stars: 10

Open Issues: 2

2.0.0 2023-10-20 15:14 UTC

This package is auto-updated.

Last update: 2026-09-17 15:10:46 UTC


README

Deprecation notice

This client uses the legacy S2S authentication of the Wildix PBX API (X-APP-ID header plus a signed Authorization: Bearer <JWT>). S2S is being retired:

  • New integrations must use Company API Keys instead of S2S credentials.
  • Company API Keys are available on PBX version 7.09 and later.
  • New S2S applications can no longer be created in WMS, and expired ones cannot be renewed.
  • S2S retirement is planned for 2027.

Migration guide: Company API Keys for the PBX explains how to create a key, which scopes to grant, and how to call the PBX API with it. The API reference stays available on your PBX at https://<pbx>/api/v1/doc/.

Wildix Integration is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services.

$ composer require wildix/s2s-client-php

Example

Create instance

$config = [
    'host' => 'https://example-host.com',
    'app_id' => 'APP_ID',
    'secret_key' => 'APP_SECRET',
    'app_name' => 'APP_NAME',
];

$client = new \Wildix\Integrations\Client($config, []);

Create custom instance defaults

Params using all params from guzzle http client.

$config = [
    'host' => 'https://example-host.com',
    'app_id' => 'APP_ID',
    'secret_key' => 'APP_SECRET',
    'app_name' => 'APP_NAME',
];

//example params
$params = [
    // You can set any number of default request options.
    'timeout'  => 2.0
];

$client = new \Wildix\Integration\Client($config, $params);

Example 'GET' query

$options = [
    'params' => [
        'param1'=>'value1',
        'param2'=>'value2',
    ]
];
$response = $client->get('/api/v1/example/', $options);

echo $response->getStatusCode(); // 200
echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
echo $response->getBody()->getContents(); // '{"type": "result", "result": {}}'

Request method aliases

$client->get(apiPoint[, $options])
$client->delete(apiPoint[, $options])
$client->post(apiPoint[, $options])
$client->put(apiPoint[, $options])

Examples

For convenience aliases have been provided for supported request methods.

$options = [
    'params' => [
        'param1'=>'value1',
        'param2'=>'value2',
    ],
    'body' => [
        'field1'=>'value1',
        'field2'=>'value2',
    ],
    'headers' => [
        'content-type' => 'application/json'
    ]
];

$client->post(apiPoint[, $options]);

Request options config

$options = [
    // 'params' are the URL parameters to be sent with the request
    'params' => [
        'param1'=>'value1',
        'param2'=>'value2',
    ],
    // 'body' is the data to be sent as the request body
    'body' => [
        'field1'=>'value1',
        'field2'=>'value2',
    ],
    // 'headers' are custom headers to be sent
    'headers' => [
        'content-type' => 'application/json'
    ]
];