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

# Introduction

> Learn how to configure and add your first contact with SendX PHP SDK

## Prerequisites

To get the most out of this guide, you’ll need to:

* [**Create a SendX Account**](https://app.sendx.io/register)
* [**Install PHP 7.4+**](https://www.php.net/downloads.php)

## 1. Install

### **Composer**

To install the bindings via [<u>Composer</u>](https://getcomposer.org/), use the following command on the command line:

```shellscript shell theme={null}
composer require sendx/sendx-php-sdk
```

Or, add the following to `composer.json`:

```json composer.json theme={null}
  "require": {
      "sendx/sendx-php-sdk": "1.0.0"
  }
```

Then run `composer install`

### **Manual Installation**

Download the files and include `autoload.php`:

```php theme={null}
<?php
require_once('/path/to/sendx/vendor/autoload.php');
```

## 2. Getting Started

```php PHP theme={null}
<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure API key authorization: apiKeyAuth
$config = sendx\Configuration::getDefaultConfiguration()->setApiKey('X-Team-ApiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = sendx\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Team-ApiKey', 'Bearer');


$apiInstance = new sendx\Api\ContactApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$contact_request = new \sendx\model\ContactRequest(); // \sendx\model\ContactRequest
$contact_request->setEmail("john@doe.com"); // Required: Set email
$contact_request->setFirstName("John"); // Optional: Set first name
$contact_request->setLastName("Doe"); // Optional: Set last name
$contact_request->setCompany("SendX"); // Optional: Set company
$contact_request->setLastTrackedIp("192.168.1.1"); // Optional: Set last tracked IP
$contact_request->setCustomFields(["sendf13kn2k3kjm2d" => "Developer", "ckjsnck234nm2kn42" => "Engineering"]); // Optional: Set custom fields
$contact_request->setLists(["list_id_1", "list_id_2"]); // Optional: Subscribe to lists

try {
    $result = $apiInstance->createContact($contact_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->createContact: ', $e->getMessage(), PHP_EOL;
}
```

## 3. Try it for yourself

<Card title="PHP Example" icon="arrow-up-right-from-square" href="https://github.com/sendx/sendx-php-sdk">
  See detailed sdk example
</Card>
