This is a Wrapper for Spotify Web API PHP
- PHP 7.2 or later.
- PHP cURL extension (Usually included with PHP).
Add ENV-Variable:
CLIENT_ID = ###my_client_id###
CLIENT_SECRET = ###my_client_secret###
REDIRECT_URI = ###my_redirect_uri###
REFRESH_TOKEN = ###my_refresh_token###
You can set the Env-Variable with this packages: PHP dotenv or Symfony DotEnv
or manual in your application $_ENV['CLIENT_ID']=CLIENT_ID
Factory-Class SpotifyApiConnectFactory
give you access to main function
First you should set CLIENT_ID
, CLIENT_SECRET
, REDIRECT_URI
ENV-Variable.
REDIRECT_URI is you application URL
For Redirect-Url pleas use this class: SpotifyApiConnect\Application\SpotifyWebApiPhp\Session
-> Factory: (new SpotifyApiConnectFactory)->createSpotifyApiAuth()
Here is a Symfony example: https://github.com/wesolowski/symfony-spotify-playlist-update/blob/master/src/Component/Token/Communication/Controller/Token.php
When you get a Refresh Token pleas save this in $_ENV['REFRESH_TOKEN']