# PHP

{% hint style="info" %}
The Hackle PHP SDK supports PHP version 7.1.33 and above.

Please use PHP SDK from version 1.0.0 onwards.
{% endhint %}

## Add SDK Dependency

Add the SDK dependency.

[![](https://img.shields.io/packagist/v/hackle/hackle-php-sdk)](https://packagist.org/packages/hackle/hackle-php-sdk)

```php
php composer.phar require hackle/hackle-php-sdk:{sdk_version}

//OR
composer require hackle/hackle-php-sdk:{sdk_version}
```

Then autoload it.

```php
require 'vendor/autoload.php';
```

## SDK Initialization

`HackleClient` is the class that provides methods for using SDK features.\
To use the SDK, you need to initialize `HackleClient`.

#### Instantiation

Instantiate `HackleClient` by passing the SDK Key.

`HackleClient` periodically caches data to a file each time you use the methods provided by Hackle, in order to obtain the necessary information.

* You can find the SDK Key in [SDK Integration Info](https://dashboard.hackle.io/config/sdk-setting) located inside the Hackle Service Dashboard.
* Cache information is stored in `/tmp/hackle/`.

```php
$client = \Hackle\HackleClients::create("YOUR_SERVER_SDK_KEY");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hackle.io/en/development-guide/php.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
