spotify-web-api-php | A PHP wrapper for Spotify 's Web API | REST library
kandi X-RAY | spotify-web-api-php Summary
kandi X-RAY | spotify-web-api-php Summary
This is a PHP wrapper for Spotify's Web API. It includes the following:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Send the request to the server
- Delete a playlist
- Refresh access token .
- Send API request .
- Request an access token .
- Handles a response error .
- Determine if the request has invalid credentials .
- Sets the reason reason
- Get reason .
- Determine if the request has an invalid refresh token .
spotify-web-api-php Key Features
spotify-web-api-php Examples and Code Snippets
Community Discussions
Trending Discussions on spotify-web-api-php
QUESTION
I am currently new to using php and Laravel and working with an API however I have been following the Spotify PHP tutorial https://github.com/jwilsson/spotify-web-api-php.
I've also put in bold some of my questions that I wanted to ask , hopefully someone can help.
I have followed all steps but need help just to get it working.
Put the following code in its own file, lets call it auth.php. Replace CLIENT_ID and CLIENT_SECRET with the values given to you by Spotify.
(Where abouts should I save this file?)
The REDIRECT_URI is the one you entered when creating the Spotify app, make sure it's an exact match.
(I used my localhost:8888/callback/ not sure if that is correct?) Obviously I haven't put me details in here on this website as for security reasons.
...ANSWER
Answered 2018-Nov-05 at 16:50(Where abouts should I save this file?)
You can save this file in differents places in laravel, for testing you could write it in a controller (not the best but you can).
Do replace client id and secret with my detail?
Yes of course !
also how do I save the access token?
You can save in a database or in a session or where you want. If you store it in a session you will have to make a new request to get a new Access token if the user logged out of your application. In a database you can reuse it.
Many access token are only available for a specific duration. The spotify doc should speak of it.
(Where do i also save this file and how do I make these calls in my Laravel Controllers?)
For testing you can do this in your controller, but it's a good idea to have a service layer where you put the business logic of your application.
Do not copy require 'vendor/autoload.php';
in your file laravel handle the composer autoload already.
QUESTION
I am using this php library to communicate with the spotify api to get my user details. The spotify api returns user data which I then want to add to a json file. Basically, whatever is sent back from the api I want to append to the json file for each user.
The data returned from the api looks like the following when I do print_r($api->me());
This is basically coming from this api call.
ANSWER
Answered 2017-Jun-22 at 08:10As $api->me()
returns object
- you cannot write it to a file directly. You should convert object to a string
. Simple way is to json_encode
it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spotify-web-api-php
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page