wesolowski / spotify-api-connect
Requires
- php: >=7.2.0
- jwilsson/spotify-web-api-php: 2.10.0
- xervice/data-provider: ^2.3
Requires (Dev)
This package is auto-updated.
Last update: 2025-02-19 23:25:46 UTC
README
This is a Wrapper for Spotify Web API PHP
Requirements
- PHP 7.2 or later.
- PHP cURL extension (Usually included with PHP).
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']