Download the PHP package rgjoni/spotify-web-api-sdk without Composer
On this page you can find all versions of the php package rgjoni/spotify-web-api-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rgjoni/spotify-web-api-sdk
More information about rgjoni/spotify-web-api-sdk
Files in rgjoni/spotify-web-api-sdk
Package spotify-web-api-sdk
Short Description Spotify Web API SDK for PHP
License GPL-3.0-only
Informations about the package spotify-web-api-sdk
Spotify Web API SDK
An SDK for the Spotify Web API, covering all available endpoints and offering different authorization flows.
Reference link (external)
Table of contents
- Supported API's
- Supported authorization flows
- Dependencies
- Development dependencies
- Installation
- Namespace
- Usage
- First Steps
- Authorization
- Authorization Code Flow
- Authorization Code Flow with Proof Key for Code Exchange(PKCE)
- Client Credentials Flow
- Persisting tokens
- Web API Endpoints
- Errors & Exceptions
- Contributing
- License
Supported API's
- Search API
- Browse API
- Follow API
- Playlists API
- Library API
- Artists API
- Player API
- Markets API
- Personalization API
- User Profile API
- Albums API
- Tracks API
- Episodes API
- Shows API
Supported authorization flows
- Authorization Code
- Authorization Code with Proof Key for Code Exchange(PKCE)
- Client Credentials
Dependencies
- PHP 8.0 or higher
- Guzzle
Development dependencies
- PHPUnit
Installation
Using composer:
Namespace
Usage
First steps
Firstly, create a main Sdk object with the client credentials(client id, client secret), scopes and the redirect uri. For the credentials, you have to create an app on the developer dashboard.
Authorization
After having created the main sdk object, these are the different ways to authorize your App to act on behalf of a user.
Authorization Code Flow
Authorization Code Flow with Proof Key for Code Exchange(PKCE)
-
Generate code verifier & challenge, persist the verifier and build the url.
- After getting an authorization code on behalf of the end-user, seek access.
Client Credentials Flow
Persisting tokens
This SDK does not offer tokens persistence(access & refresh token), so that responsibility falls on the consuming project. In the examples in this README, cookie storage is used; but it's not the only possibility, read this & this(external links) for more information.
Web API Endpoints
Now that you have successfully authorized your App and persisted your tokens, now's the time to have some fun and request some user data!
Current user's profile
A public user's profile
The latter outputs the following JSON response:
Get a single artist
This outputs the following JSON response:
Errors & Exceptions
If you make an API request when the access token has expired, the following exception will be thrown:
Gjoni\SpotifyWebApiSdk\Exception\AccessTokenExpiredException
with the message:
The access token has expired, please refresh the token.
and the error code .
Other, usage errors, such as not providing the right parameter or the wrong amount of them, will cause the to bubble up to the top, necessitating to be handled by the project.
Contributing
Pull requests and issues are welcome, please refer to CONTRIBUTORS.md
License
GPLv3