# PHP SDK (ingest)

> Quickly integrate the Ours Privacy PHP SDK using Composer. Send test requests from the Track Events API reference.

Source: https://docs.oursprivacy.com/docs/php

Use this page to install the Ours Privacy PHP SDK and send events from your server. Every request takes your Ingest API source's API key as `token`. Copy it from the **API Keys** card on the source's **Settings** tab.

## Installation

Install the SDK via Composer:

```bash
composer require oursprivacy/ingest-sdk guzzlehttp/guzzle
```

The SDK works with any PSR-18 HTTP client and finds it through `php-http/discovery`. The command above installs Guzzle; skip it if your project already has a PSR-18 client.

For more details, visit the [packagist repository](https://packagist.org/packages/oursprivacy/ingest-sdk) | [Github Repo](https://github.com/with-ours/ingest-sdk-php)

## Usage

Create a client and track an event:

```php
<?php

use OursPrivacy\Client;

$client = new Client();

// Track an event
$response = $client->track->event(token: 'your-source-token', event: 'Purchase');

var_dump($response->success);
```

## Next Steps

* [Ingest API Integration](https://docs.oursprivacy.com/docs/server-to-server-integration): match events to visitors, backfill past events, and test with a Test Mode key.
* [Track Events API reference](https://docs.oursprivacy.com/docs/reference/track) and [Identify Visitors API reference](https://docs.oursprivacy.com/docs/reference/identify): every field the SDK accepts.
* [PHP SDK on GitHub](https://github.com/with-ours/ingest-sdk-php): retries, timeouts, and error handling.
