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
// src/Controller/MusicController.php
namespace App\Controller;
use Calliostro\Discogs\DiscogsClient;
use Symfony\Component\HttpFoundation\JsonResponse;
class MusicController
{
public function artistInfo(string $id, DiscogsClient $client): JsonResponse
{
$artist = $client->getArtist(artistId: $id);
$releases = $client->listArtistReleases(artistId: $id, perPage: 5);
return new JsonResponse([
'artist' => $artist['name'],
'profile' => $artist['profile'] ?? null,
'releases' => $releases['releases'],
]);
}
}
// Requires Personal Access Token
$collection = $client->listCollectionItems(username: 'your-username', folderId: 0);
$wantlist = $client->getUserWantlist(username: 'your-username');
$client->addToCollection(
username: 'your-username',
folderId: 1,
releaseId: 30359313 // Billie Eilish - Happier Than Ever
);
$client->addToWantlist(username: 'your-username', releaseId: 28409710); // Taylor Swift - Midnights