There are a lot of information about the music on Spotify that can be retrieved. Everything from info about a single track to an artist's top tracks in each country.
require 'vendor/autoload.php';
$api = new SpotifyWebAPI\SpotifyWebAPI();
$track = $api->getTrack('TRACK_ID');
echo '<b>' . $track->name . '</b> by <b>' . $track->artists[0]->name . '</b>';Fetching artists or albums is extremely similar, simply change getTrack to getArtist or getAlbum.
require 'vendor/autoload.php';
$api = new SpotifyWebAPI\SpotifyWebAPI();
$artists = $api->getArtists([
'ARTIST_ID',
'ARTIST_ID',
]);
foreach ($artists->artists as $artist) {
echo '<b>' . $artist->name . '</b> <br>';
}Of course, getAlbums and getTracks also exist and work in the same way.
$tracks = $api->getAlbumTracks('ALBUM_ID');
foreach ($tracks->items as $track) {
echo '<b>' . $track->name . '</b> <br>';
}$albums = $api->getArtistAlbums('ARTIST_ID');
foreach ($albums->items as $album) {
echo '<b>' . $album->name . '</b> <br>';
}$artists = $api->getArtistRelatedArtists('ARTIST_ID');
foreach ($artists->artists as $artist) {
echo '<b>' . $artist->name . '</b> <br>';
}$tracks = $api->getArtistTopTracks('ARTIST_ID', [
'country' => 'se',
]);
foreach ($tracks->tracks as $track) {
echo '<b>' . $track->name . '</b> <br>';
}$analysis = $api->getAudioAnalysis('TRACK_ID');
print_r($analysis);$seedGenres = $api->getGenreSeeds();
$recommendations = $api->getRecommendations([
'seed_genres' => $seedGenres->dance,
]);
print_r($recommendations);Please see the method reference for more available options for each method.