PHPackages                             torbox/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. torbox/sdk

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

torbox/sdk
==========

The official TorBox SDK in PHP

1.0.1(1y ago)09MITPHPPHP ^8.0

Since Apr 26Pushed 1y agoCompare

[ Source](https://github.com/TorBox-App/torbox-sdk-php)[ Packagist](https://packagist.org/packages/torbox/sdk)[ RSS](/packages/torbox-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (10)Versions (2)Used By (0)

[![Logo](https://raw.githubusercontent.com/TorBox-App/torbox-sdk-php/main/assets/banner.png)](https://raw.githubusercontent.com/TorBox-App/torbox-sdk-php/main/assets/banner.png)

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

[](#table-of-contents)

- [Setup &amp; Configuration](#setup--configuration)
    - [Supported Language Versions](#supported-language-versions)
    - [Installation](#installation)
- [Authentication](#authentication)
    - [Access Token Authentication](#access-token-authentication)
- [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.0`

### Installation

[](#installation)

To get started with the SDK, we recommend installing using `composer`:

```
composer require torbox/sdk
```

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

[](#authentication)

### Access Token Authentication

[](#access-token-authentication)

The torbox-api API uses an Access Token for authentication.

This token must be provided to authenticate your requests to the API.

#### Setting the Access Token

[](#setting-the-access-token)

When you initialize the SDK, you can set the access token as follows:

```
new Client(accessToken: "YOUR_ACCESS_TOKEN");
```

If you need to set or update the access token after initializing the SDK, you can use:

```
sdk.setAccessToken("YOUR_ACCESS_TOKEN")
```

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:

```
