PHPackages                             celitech-sdk/sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. celitech-sdk/sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

celitech-sdk/sdk
================

2.0.4(2w ago)01351[70 PRs](https://github.com/Celitech/CelitechSDKPHP/pulls)MITPHPPHP ^8.1CI passing

Since Dec 6Pushed 2w ago1 watchersCompare

[ Source](https://github.com/Celitech/CelitechSDKPHP)[ Packagist](https://packagist.org/packages/celitech-sdk/sdk)[ RSS](/packages/celitech-sdk-sdk/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (40)Versions (94)Used By (0)

Celitech PHP SDK 2.0.2
======================

[](#celitech-php-sdk-202)

Welcome to the Celitech SDK documentation. This guide will help you get started with integrating and using the Celitech SDK in your project.

Versions
--------

[](#versions)

- API version: `2.0.2`
- SDK version: `2.0.2`

About the API
-------------

[](#about-the-api)

Welcome to the CELITECH API documentation!

Useful links: [Homepage](https://www.celitech.com) | [Support email](mailto:support@celitech.com) | [Blog](https://www.celitech.com/blog/)

Table of Contents
-----------------

[](#table-of-contents)

- [Setup &amp; Configuration](#setup--configuration)
    - [Supported Language Versions](#supported-language-versions)
    - [Installation](#installation)
- [Authentication](#authentication)
    - [OAuth Authentication](#oauth-authentication)
    - [Environment Variables](#environment-variables)
- [Setting a Custom Timeout](#setting-a-custom-timeout)
- [Sample Usage](#sample-usage)
- [Services](#services)
- [Models](#models)
- [License](#license)

Setup &amp; Configuration
=========================

[](#setup--configuration)

Supported Language Versions
---------------------------

[](#supported-language-versions)

This SDK is compatible with the following versions: `PHP >= 8.1`

Installation
------------

[](#installation)

### Using a local path (recommended for development)

[](#using-a-local-path-recommended-for-development)

To use the SDK in your project before it is published to Packagist, add a `path` repository entry in your project's `composer.json` pointing to the SDK directory:

```
{
  "repositories": [
    {
      "type": "path",
      "url": "/path/to/celitech-sdk/sdk"
    }
  ]
}
```

Then run:

```
composer require celitech-sdk/sdk
```

### Using Packagist or a private registry

[](#using-packagist-or-a-private-registry)

If the package is published to Packagist or a private Composer registry, install directly:

```
composer require celitech-sdk/sdk
```

Verifying the SDK setup
-----------------------

[](#verifying-the-sdk-setup)

To verify the SDK works correctly, you can run the included example project:

1. Install dependencies:

```
composer install
```

2. Run the example:

```
php example/index.php
```

Authentication
--------------

[](#authentication)

### OAuth Authentication

[](#oauth-authentication)

The Celitech API uses OAuth 2.0 for authentication.

You need to provide your OAuth credentials when initializing the SDK. Tokens are automatically fetched, cached, and refreshed — you do not need to manage them yourself.

```
new Client(
    clientId: 'CLIENT_ID',
    clientSecret: 'CLIENT_SECRET'
)
```

If you need to set or update the OAuth credentials after the SDK initialization, you can use:

```
$sdk->setClientId('CLIENT_ID')
$sdk->setClientSecret('CLIENT_SECRET')
```

Environment Variables
---------------------

[](#environment-variables)

These are the environment variables for the SDK:

NameDescriptionCLIENT\_IDClient ID parameterCLIENT\_SECRETClient Secret parameterEnvironment variables are a way to configure your application outside the code. You can set these environment variables on the command line or use your project's existing tooling for managing environment variables.

If you are using a `.env` file, a template with the variable names is provided in the `.env.example` file located in the same directory as this README.

Setting a Custom Timeout
------------------------

[](#setting-a-custom-timeout)

You can set a custom timeout for the SDK's HTTP requests as follows:

```
$sdk = new Client(timeout: 1000);
```

Sample Usage
============

[](#sample-usage)

Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:

```
