> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP SDK advanced usage

> Response data access, SSL/TLS compatibility and configuration, development workflow, and plugin development for the Telnyx PHP SDK.

## Accessing Response Data

You can access the data from the last API response on any object via `getLastResponse()`.

```php theme={null}
$order = \Telnyx\NumberOrder::create(['phone_number' => '+18665552368']);
print_r($order->getLastResponse()->headers);
```

## SSL / TLS Compatibility issues

Telnyx's API now requires that all connections use TLS 1.2. Some systems (most notably some older CentOS and RHEL versions) are capable of using TLS 1.2 but will use TLS 1.0 or 1.1 by default.

The recommended course of action is to upgrade your cURL and OpenSSL packages so that TLS 1.2 is used by default, but if that is not possible, you might be able to solve the issue by setting the `CURLOPT_SSLVERSION` option to either `CURL_SSLVERSION_TLSv1` or `CURL_SSLVERSION_TLSv1_2`:

```php theme={null}
$curl = new \Telnyx\HttpClient\CurlClient([CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1]);
\Telnyx\ApiRequestor::setHttpClient($curl);
```

## SSL / TLS Configuration Option

See the "SSL / TLS compatibility issues" paragraph above for full context. If you want to
ensure that your plugin can be used on all systems, you should add a configuration option
to let your users choose between different values for
`CURLOPT_SSLVERSION`: none (default), `CURL_SSLVERSION_TLSv1` and `CURL_SSLVERSION_TLSv1_2`.

## Development

Unit tests rely on a mock server so all unit tests are ran through
docker.  To run all unit tests execute:

```
docker-compose run --rm php composer test
```

Running unit tests with code coverage requires you build the docker
container with XDEBUG=1

```
docker-compose build --build-arg XDEBUG=1
```

then run the unit tests as

```
docker-compose run --rm php composer test-coverage
```

## Plugin Developers

Are you writing a plugin that integrates Telnyx and embeds our library? Then please use the `setAppInfo` function to identify your plugin. For example:

```php theme={null}
\Telnyx\Telnyx::setAppInfo("MyCustomPlugin", "1.2.3", "https://customplugin.yoursite.com");
```

The method should be called once before any request is sent to the API. The second and third parameters are optional.
