PHPackages                             gerenuk/php-tidal-api - 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. [API Development](/categories/api)
4. /
5. gerenuk/php-tidal-api

ActiveLibrary[API Development](/categories/api)

gerenuk/php-tidal-api
=====================

A PHP wrapper for Tidal's Api.

v1.0.0(1y ago)410MITPHPPHP ^8.0

Since Dec 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Gerenuk-LTD/php-tidal-api)[ Packagist](https://packagist.org/packages/gerenuk/php-tidal-api)[ Docs](https://github.com/Gerenuk-LTD/php-tidal-api)[ RSS](/packages/gerenuk-php-tidal-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

PHP Tidal API
=============

[](#php-tidal-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6d7671f68ee5181c80d64cabf1f79af908e3a6db674971090a131a15d87b5f1d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676572656e756b2f7068702d746964616c2d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gerenuk/php-tidal-api)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8a9f3fceb0411c6879ed9cf9ffcdd272aa3bc94f72e1a74b1f902ff4ed798fdb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f676572656e756b2d6c74642f7068702d746964616c2d6170692f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/gerenuk-ltd/php-tidal-api/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/60367974464fbc5e6dee573c5116e75c4416bebfecffc4d73f0ecd27c77fcafc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f676572656e756b2d6c74642f7068702d746964616c2d6170692f6669782d7068702d636f64652d7374796c696e672e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/gerenuk-ltd/php-tidal-api/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/9b9bc84591715caf04f92dc4cba17b861fd2a777c16d072d1650877200af284b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676572656e756b2f7068702d746964616c2d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gerenuk/php-tidal-api)

This is a PHP wrapper for [Tidal's API](https://developer.tidal.com/documentation). It is a modified version of [jwilsson/spotify-web-api-php](https://github.com/jwilsson/spotify-web-api-php).

Warning

This package currently only supports the official [Tidal's API](https://developer.tidal.com/documentation) endpoints.

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

[](#table-of-contents)

1. [Introduction](#php-tidal-api)
2. [Version Compatability](#version-compatability)
3. [Requirements](#requirements)
4. [Installation](#installation)
5. [Usage](#usage)
6. [Changelog](#changelog)
7. [Contributing](#contributing)
8. [Security Vulnerabilities](#security-vulnerabilities)
9. [Credits](#credits)
10. [License](#license)

Version Compatability
---------------------

[](#version-compatability)

PluginPHP1.x8.xRequirements
------------

[](#requirements)

- PHP 8.0 or later.
- PHP [cURL extension](http://php.net/manual/en/book.curl.php) (Usually included with PHP).

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

[](#installation)

You can install the package via composer:

```
composer require gerenuk/php-tidal-api
```

Usage
-----

[](#usage)

Before using the Tidal API you will need to create an app at [Tidal's developer website](https://developer.tidal.com/dashboard).

Simple example to retrieve the currently authenticated user's playlists:

### Step 1:

[](#step-1)

Put the following code in its own file, lets call it `auth.php`. Replace `CLIENT_ID` with the value given to you by Tidal. The `REDIRECT_URI` is the one you entered when creating the Tidal app, make sure it's an exact match. You'll also need to create a *code verifier* and store it somewhere between requests. It will be used again in the second step.

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

$session = new TidalApi\Session(
    'CLIENT_ID',
    '', // Normally the client secret, but this value can be omitted when using the PKCE flow.
    'REDIRECT_URI'
);

$verifier = $session->generateCodeVerifier(); // Store this value somewhere, a session for example.
$challenge = $session->generateCodeChallenge($verifier);
$state = $session->generateState();

$options = [
    'code_challenge' => $challenge,
    'scope' => [
        'playlists.read',
    ],
    'state' => $state,
];

header('Location: ' . $session->getAuthorizeUrl($options));
die();
```

**Note:** The `state` parameter is optional but highly recommended to prevent CSRF attacks. The value will need to be stored between requests and verified when the user is redirected back to your application from Tidal.

### Step 2:

[](#step-2)

When the user has approved your app, Tidal will redirect the user together with a `code` to the specified redirect URI. You'll need to use this code to request an access token from Tidal. The *code verifier* created in the previous step will also be needed.

**Note:** The API wrapper does not include any token management. It's up to you to save the access token somewhere (in a database, a PHP session, or wherever appropriate for your application) and request a new access token when the old one has expired.

Let's put this code in a new file called `callback.php`:

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

$session = new TidalApi\Session(
    'CLIENT_ID',
    'CLIENT_SECRET',
    'REDIRECT_URI'
);

$state = $_GET['state'];

// Fetch the stored state value from somewhere. A session for example.

if ($state !== $storedState) {
    // The state returned isn't the same as the one we've stored, we shouldn't continue.
    die('State mismatch');
}

// Request an access token using the code from Tidal and the previously created code verifier.
$session->requestAccessToken($_GET['code'], $verifier);

$accessToken = $session->getAccessToken();
$refreshToken = $session->getRefreshToken();

// Store the access and refresh tokens somewhere. In a session for example.

// Send the user along and fetch some data!
header('Location: app.php');
die();
```

When requesting an access token, a **refresh token** will also be included. This can be used to extend the validity of access tokens. It's recommended to also store this somewhere persistent, in a database for example.

### Step 3:

[](#step-3)

In a third file, `app.php`, tell the API wrapper which access token to use, and then make some API calls!

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

$api = new TidalApi\TidalApi();

// Fetch the saved access token from somewhere. A session for example.
$api->setAccessToken($accessToken);

// It's now possible to request the currently authenticated user's playlists.
print_r(
    $api->getMyPlaylists()
);
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- Modified version of [spotify-web-api-php](https://github.com/jwilsson/spotify-web-api-php) from [jwilsson](https://github.com/jwilsson)
- [Kieran Proctor](https://github.com/KieranLProctor)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance40

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

2

Last Release

518d ago

Major Versions

v0.0.1 → v1.0.02024-12-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/37cb30836c345ea33ed93979772cdf6fddde778e7b6199ed280ad4024f6aaeb2?d=identicon)[gerenuk](/maintainers/gerenuk)

---

Top Contributors

[![KieranLProctor](https://avatars.githubusercontent.com/u/25559341?v=4)](https://github.com/KieranLProctor "KieranLProctor (25 commits)")

---

Tags

composerphptidaltidal-apiGerenukTidaltidal-api

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/gerenuk-php-tidal-api/health.svg)

```
[![Health](https://phpackages.com/badges/gerenuk-php-tidal-api/health.svg)](https://phpackages.com/packages/gerenuk-php-tidal-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
