1. Go to this page and download the library: Download calliostro/discogs-bundle 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/ */
calliostro / discogs-bundle example snippets
namespace App\Controller;
use Calliostro\Discogs\DiscogsClient;
use Symfony\Component\HttpFoundation\JsonResponse;
final class MusicController
{
public function artistInfo(string $id, DiscogsClient $client): JsonResponse
{
$artist = $client->getArtist(artistId: (int) $id);
$releases = $client->listArtistReleases(artistId: (int) $id, perPage: 5);
return new JsonResponse([
'artist' => $artist['name'],
'profile' => $artist['profile'] ?? null,
'releases' => $releases['releases'],
]);
}
}