Skip to content

wesolowski/spotify-api-connect

Repository files navigation

Spotify API Connect for PHP

Build Status codecov Scrutinizer Code Quality

This is a Wrapper for Spotify Web API PHP

Requirements

Start

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

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']