PHP code example of pouler / spotify-charts-api
1. Go to this page and download the library: Download pouler/spotify-charts-api library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pouler / spotify-charts-api example snippets
declare(strict_types=1);
ponent\HttpClient\CurlHttpClient();
$apiClient = new \PouleR\SpotifyChartsAPI\SpotifyChartsAPIClient($httpClient);
$spotifyApi = new \PouleR\SpotifyChartsAPI\SpotifyChartsAPI($apiClient);
$spotifyApi->setAccessToken('access.token');
$charts = $spotifyApi->getRegionalTopSongs('nl', 'weekly');
echo $result->getDisplayChart()->getChartMetadata()->getReadableTitle() . PHP_EOL;
foreach ($charts->getEntries() as $entry) {
echo $entry->getChartEntryData()->getCurrentRank() . ' --> ' . $entry->getTrackMetadata()->getTrackName() . PHP_EOL;
}