Property | Type | Description | |
---|---|---|---|
$accessToken | |||
$lastResponse | |||
$request |
Method | Description | |
---|---|---|
__construct ( |
Constructor Set up Request object. | |
addMyAlbums ( string | array $albums ) : boolean | Add albums to the current user's Spotify library. | |
addMyTracks ( string | array $tracks ) : boolean | Add tracks to the current user's Spotify library. | |
addUserPlaylistTracks ( string $userId, string $playlistId, string | array $tracks, array | object $options = [] ) : boolean | Add tracks to a user's playlist. | |
createUserPlaylist ( string $userId, array | object $options ) : array | object | Create a new playlist for a user. | |
currentUserFollows ( string $type, string | array $ids ) : array | Check to see if the current user is following one or more artists or other Spotify users. | |
deleteMyAlbums ( string | array $albums ) : boolean | Delete albums from current user's Spotify library. | |
deleteMyTracks ( string | array $tracks ) : boolean | Delete tracks from current user's Spotify library. | |
deleteUserPlaylistTracks ( string $userId, string $playlistId, array $tracks, string $snapshotId = '' ) : string | boolean | Delete tracks from a playlist and retrieve a new snapshot ID. | |
followArtistsOrUsers ( string $type, string | array $ids ) : boolean | Add the current user as a follower of one or more artists or other Spotify users. | |
followPlaylist ( string $userId, string $playlistId, array | object $options = [] ) : boolean | Add the current user as a follower of a playlist. | |
getAlbum ( string $albumId ) : array | object | Get a album. | |
getAlbumTracks ( string $albumId, array | object $options = [] ) : array | object | Get a album's tracks. | |
getAlbums ( array $albumIds, array | object $options = [] ) : array | object | Get multiple albums. | |
getArtist ( string $artistId ) : array | object | Get an artist. | |
getArtistAlbums ( string $artistId, array | object $options = [] ) : array | object | Get an artist's albums. | |
getArtistRelatedArtists ( string $artistId ) : array | object | Get an artist's related artists. | |
getArtistTopTracks ( string $artistId, array | object $options ) : array | object | Get an artist's top tracks in a country. | |
getArtists ( array $artistIds ) : array | object | Get multiple artists. | |
getAudioFeatures ( array $trackIds ) : array | object | Get track audio features. | |
getCategoriesList ( array | object $options = [] ) : array | object | Get a list of categories used to tag items in Spotify (on, for example, the Spotify player’s "Browse" tab). | |
getCategory ( string $categoryId, array | object $options = [] ) : array | object | Get a single category used to tag items in Spotify (on, for example, the Spotify player’s "Browse" tab). | |
getCategoryPlaylists ( string $categoryId, array | object $options = [] ) : array | object | Get a list of Spotify playlists tagged with a particular category. | |
getFeaturedPlaylists ( array | object $options = [] ) : array | object | Get Spotify featured playlists. | |
getGenreSeeds ( ) : array | object | Get a list of possible seed genres. | |
getLastResponse ( ) : array | Get the latest full response from the Spotify API. | |
getMyPlaylists ( array | object $options = [] ) : array | object | Get the current user’s playlists. | |
getMySavedAlbums ( array | object $options = [] ) : array | object | Get the current user’s saved albums. | |
getMySavedTracks ( array | object $options = [] ) : array | object | Get the current user’s saved tracks. | |
getMyTop ( string $type, $options = [] ) : array | object | Get the current user's top tracks or artists. | |
getNewReleases ( array | object $options = [] ) : array | object | Get new releases. | |
getRecommendations ( array | object $options = [] ) : array | object | Get recommendations based on artists, tracks, or genres. | |
getReturnAssoc ( ) : boolean | Get the return type for the Request body element. | |
getTrack ( string $trackId, array | object $options = [] ) : array | object | Get a track. | |
getTracks ( array $trackIds, array | object $options = [] ) : array | object | Get multiple tracks. | |
getUser ( string $userId ) : array | object | Get a user. | |
getUserFollowedArtists ( array | object $options = [] ) : array | object | Get the artists followed by the current user. | |
getUserPlaylist ( string $userId, string $playlistId, array | object $options = [] ) : array | object | Get a user's specific playlist. | |
getUserPlaylistTracks ( string $userId, string $playlistId, array | object $options = [] ) : array | object | Get the tracks in a user's playlist. | |
getUserPlaylists ( string $userId, array | object $options = [] ) : array | object | Get a user's playlists. | |
me ( ) : array | object | Get the currently authenticated user. | |
myAlbumsContains ( string | array $albums ) : array | Check if albums are saved in the current user's Spotify library. | |
myTracksContains ( string | array $tracks ) : array | Check if tracks are saved in the current user's Spotify library. | |
reorderUserPlaylistTracks ( string $userId, string $playlistId, array | object $options ) : string | boolean | Reorder the tracks in a user's playlist. | |
replaceUserPlaylistTracks ( string $userId, string $playlistId, string | array $tracks ) : boolean | Replace all tracks in a user's playlist with new ones. | |
search ( string $query, string | array $type, array | object $options = [] ) : array | object | Search for an item. | |
setAccessToken ( string $accessToken ) : void | Set the access token to use. | |
setReturnAssoc ( boolean $returnAssoc ) : void | Set the return type for the Request body element. | |
unfollowArtistsOrUsers ( string $type, string | array $ids ) : boolean | Remove the current user as a follower of one or more artists or other Spotify users. | |
unfollowPlaylist ( string $userId, string $playlistId ) : boolean | Remove the current user as a follower of a playlist. | |
updateUserPlaylist ( string $userId, string $playlistId, array | object $options ) : boolean | Update the details of a user's playlist. | |
userFollowsPlaylist ( string $ownerId, string $playlistId, array | object $options ) : array | Check if a user is following a playlist. |
Method | Description | |
---|---|---|
authHeaders ( ) : array | Add authorization headers. | |
idToUri ( array | string $ids ) : array | string | Convert Spotify object IDs to Spotify URIs. |
public __construct ( |
||
$request | Optional. The Request object to use. |
public addUserPlaylistTracks ( string $userId, string $playlistId, string | array $tracks, array | object $options = [] ) : boolean | ||
$userId | string | ID of the user who owns the playlist. |
$playlistId | string | ID of the playlist to add tracks to. |
$tracks | string | array | ID(s) of the track(s) to add. |
$options | array | object | Optional. Options for the new tracks. - int position Optional. Zero-based track position in playlist. Tracks will be appened if omitted or false. |
return | boolean | Whether the tracks was successfully added. |
protected authHeaders ( ) : array | ||
return | array | Authorization headers. |
public createUserPlaylist ( string $userId, array | object $options ) : array | object | ||
$userId | string | ID of the user to create the playlist for. |
$options | array | object | Options for the new playlist. - name string Required. Name of the playlist. - public bool Optional. Whether the playlist should be public or not. |
return | array | object | The new playlist. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public deleteUserPlaylistTracks ( string $userId, string $playlistId, array $tracks, string $snapshotId = '' ) : string | boolean | ||
$userId | string | ID of the user who owns the playlist. |
$playlistId | string | ID of the playlist to delete tracks from. |
$tracks | array | Array of arrays with tracks to delete. - id string Required. Spotify track ID. - positions int|array Optional. The track's position(s) in the playlist. |
$snapshotId | string | Optional. The playlist's snapshot ID. |
return | string | boolean | A new snapshot ID or false if the tracks weren't successfully deleted. |
public followPlaylist ( string $userId, string $playlistId, array | object $options = [] ) : boolean | ||
$userId | string | ID of the user who owns the playlist. |
$playlistId | string | ID of the playlist to follow. |
$options | array | object | Optional. Options for the followed playlist. - public bool Optional. Whether the playlist should be followed publicly or not. |
return | boolean | Whether the playlist was successfully followed. |
public getAlbumTracks ( string $albumId, array | object $options = [] ) : array | object | ||
$albumId | string | ID of the album. |
$options | array | object | Optional. Options for the tracks. - int limit Optional. Limit the number of tracks. - int offset Optional. Number of tracks to skip. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. |
return | array | object | The requested album tracks. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getAlbums ( array $albumIds, array | object $options = [] ) : array | object | ||
$albumIds | array | IDs of the albums. |
$options | array | object | Optional. Options for the albums. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. |
return | array | object | The requested albums. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getArtistAlbums ( string $artistId, array | object $options = [] ) : array | object | ||
$artistId | string | ID of the artist. |
$options | array | object | Optional. Options for the albums. - string|array album_type Optional. Album type(s) to return. If omitted, all album types will be returned. - string market Optional. Limit the results to items that are playable in this market, for example SE. - int limit Optional. Limit the number of albums. - int offset Optional. Number of albums to skip. |
return | array | object | The artist's albums. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getArtistTopTracks ( string $artistId, array | object $options ) : array | object | ||
$artistId | string | ID of the artist. |
$options | array | object | Options for the tracks. - string $country Required. An ISO 3166-1 alpha-2 country code specifying the country to get the top tracks for. |
return | array | object | The artist's top tracks. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getCategoriesList ( array | object $options = [] ) : array | object | ||
$options | array | object | Optional. Options for the categories. - string locale Optional. Language to show categories in, for example sv_SE. - string country Optional. An ISO 3166-1 alpha-2 country code. Show categories from this country. - int limit Optional. Limit the number of categories. - int offset Optional. Number of categories to skip. |
return | array | object | The list of categories. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getCategory ( string $categoryId, array | object $options = [] ) : array | object | ||
$categoryId | string | The Spotify ID of the category. |
$options | array | object | Optional. Options for the category. - string locale Optional. Language to show category in, for example sv_SE. - string country Optional. An ISO 3166-1 alpha-2 country code. Show category from this country. |
return | array | object | The category. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getCategoryPlaylists ( string $categoryId, array | object $options = [] ) : array | object | ||
$categoryId | string | The Spotify ID of the category. |
$options | array | object | Optional. Options for the category's playlists. - string country Optional. An ISO 3166-1 alpha-2 country code. Show category playlists from this country. - int limit Optional. Limit the number of playlists. - int offset Optional. Number of playlists to skip. |
return | array | object | The list of playlists. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getFeaturedPlaylists ( array | object $options = [] ) : array | object | ||
$options | array | object | Optional. Options for the playlists. - string locale Optional. Language to show playlists in, for example sv_SE. - string country Optional. An ISO 3166-1 alpha-2 country code. Show playlists from this country. - string timestamp Optional. A ISO 8601 timestamp. Show playlists relevant to this date and time. - int limit Optional. Limit the number of playlists. - int offset Optional. Number of playlists to skip. |
return | array | object | The featured playlists. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getGenreSeeds ( ) : array | object | ||
return | array | object | All possible seed genres. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getLastResponse ( ) : array | ||
return | array | Response data. - array|object body The response body. Type is controlled by Request::setReturnAssoc(). - string headers Response headers. - int status HTTP status code. |
public getMyPlaylists ( array | object $options = [] ) : array | object | ||
$options | array | object | Optional. Options for the playlists. - int limit Optional. Limit the number of playlists. - int offset Optional. Number of playlists to skip. |
return | array | object | The user's playlists. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getMySavedAlbums ( array | object $options = [] ) : array | object | ||
$options | array | object | Optional. Options for the albums. - int limit Optional. Limit the number of albums. - int offset Optional. Number of albums to skip. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. |
return | array | object | The user's saved albums. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getMySavedTracks ( array | object $options = [] ) : array | object | ||
$options | array | object | Optional. Options for the tracks. - int limit Optional. Limit the number of tracks. - int offset Optional. Number of tracks to skip. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. |
return | array | object | The user's saved tracks. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getNewReleases ( array | object $options = [] ) : array | object | ||
$options | array | object | Optional. Options for the items. - string country Optional. An ISO 3166-1 alpha-2 country code. Show items relevant to this country. - int limit Optional. Limit the number of items. - int offset Optional. Number of items to skip. |
return | array | object | The new releases. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getRecommendations ( array | object $options = [] ) : array | object | ||
$options | array | object | Optional. Options for the recommendations. - int limit Optional. Limit the number of recommendations. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. - mixed max_* Optional. Max value for one of the tunable track attributes. - mixed min_* Optional. Min value for one of the tunable track attributes. - array seed_artists Artist IDs to seed by. - array seed_genres Genres to seed by. Call SpotifyWebAPI::getGenreSeeds() for a complete list. - array seed_tracks Track IDs to seed by. - mixed target_* Optional. Target value for one of the tunable track attributes. |
return | array | object | The requested recommendations. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getReturnAssoc ( ) : boolean | ||
return | boolean | Whether an associative array or an stdClass is returned. |
public getTrack ( string $trackId, array | object $options = [] ) : array | object | ||
$trackId | string | ID of the track. |
$options | array | object | Optional. Options for the track. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. |
return | array | object | The requested track. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getTracks ( array $trackIds, array | object $options = [] ) : array | object | ||
$trackIds | array | IDs of the tracks. |
$options | array | object | Optional. Options for the albums. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. |
return | array | object | The requested tracks. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getUserFollowedArtists ( array | object $options = [] ) : array | object | ||
$options | array | object | Optional. Options for the artists. - int limit Optional. Limit the number of artists returned. - string after Optional. The last artist ID retrieved from the previous request. |
return | array | object | A list of artists. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getUserPlaylist ( string $userId, string $playlistId, array | object $options = [] ) : array | object | ||
$userId | string | ID of the user. |
$playlistId | string | ID of the playlist. |
$options | array | object | Optional. Options for the playlist. - string|array fields Optional. A list of fields to return. See Spotify docs for more info. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. |
return | array | object | The user's playlist. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getUserPlaylistTracks ( string $userId, string $playlistId, array | object $options = [] ) : array | object | ||
$userId | string | ID of the user. |
$playlistId | string | ID of the playlist. |
$options | array | object | Optional. Options for the tracks. - string|array fields Optional. A list of fields to return. See Spotify docs for more info. - int limit Optional. Limit the number of tracks. - int offset Optional. Number of tracks to skip. - string market Optional. An ISO 3166-1 alpha-2 country code, provide this if you wish to apply Track Relinking. |
return | array | object | The tracks in the playlist. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public getUserPlaylists ( string $userId, array | object $options = [] ) : array | object | ||
$userId | string | ID of the user. |
$options | array | object | Optional. Options for the tracks. - int limit Optional. Limit the number of tracks. - int offset Optional. Number of tracks to skip. |
return | array | object | The user's playlists. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public reorderUserPlaylistTracks ( string $userId, string $playlistId, array | object $options ) : string | boolean | ||
$userId | string | ID of the user. |
$playlistId | string | ID of the playlist. |
$options | array | object | Options for the new . - int range_start Required. Position of the first track to be reordered. - int range_length Optional. The amount of tracks to be reordered. - int insert_before Required. Position where the tracks should be inserted. - string snapshot_id Optional. The playlist's snapshot ID. |
return | string | boolean | A new snapshot ID or false if the tracks weren't successfully reordered. |
public search ( string $query, string | array $type, array | object $options = [] ) : array | object | ||
$query | string | The term to search for. |
$type | string | array | The type of item to search for. |
$options | array | object | Optional. Options for the search. - string market Optional. Limit the results to items that are playable in this market, for example SE. - int limit Optional. Limit the number of items. - int offset Optional. Number of items to skip. |
return | array | object | The search results. Type is controlled by SpotifyWebAPI::setReturnAssoc(). |
public setAccessToken ( string $accessToken ) : void | ||
$accessToken | string | The access token. |
return | void |
public setReturnAssoc ( boolean $returnAssoc ) : void | ||
$returnAssoc | boolean | Whether to return an associative array or an stdClass. |
return | void |
public updateUserPlaylist ( string $userId, string $playlistId, array | object $options ) : boolean | ||
$userId | string | ID of the user who owns the playlist. |
$playlistId | string | ID of the playlist to update. |
$options | array | object | Options for the playlist. - name string Optional. Name of the playlist. - public bool Optional. Whether the playlist should be public or not. |
return | boolean | Whether the playlist was successfully updated. |
public userFollowsPlaylist ( string $ownerId, string $playlistId, array | object $options ) : array | ||
$ownerId | string | User ID of the playlist owner. |
$playlistId | string | ID of the playlist. |
$options | array | object | Options for the check. - ids string|array Required. ID(s) of the user(s) to check for. |
return | array | Whether each user is following the playlist. |