β οΈ DEMO APPLICATION NOTICE
This is a demonstration application for educational and testing purposes only. NOT intended for production use.
Please respect Discogs' terms of service and implement proper caching to avoid overloading their API servers.
For production applications, ensure you comply with Discogs API Guidelines.
This is a comprehensive demo of the calliostro/discogs-bundle
in combination with hwi/HWIOAuthBundle.
You need PHP 8.1β8.5 and Symfony 6.4 (LTS), 7.x, or 8.0 (beta).
π Search β Search the entire Discogs database
π€ User Profiles β View complete user profiles with statistics
π Collections β Browse user collections with detailed information
π Wantlists β View and manage Discogs wantlists
π΅ Artist Details β Comprehensive artist information with discography
πΏ Release Details β Complete release information including tracklists
π·οΈ Label Information β Detailed label profiles and releases
π User Lists β Custom user-created lists and list items
π Marketplace β Browse marketplace listings and inventory
π¦ Orders β View and manage marketplace orders
π² Random Discovery β Discover random releases from popular artists
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your desired parent directory for the demo, and execute:
git clone https://github.com/calliostro/discogs-bundle-demo
cd discogs-bundle-demo
composer install --no-interactionThe lock files (composer.lock, symfony.lock) are not included in this repository to ensure maximum flexibility for different PHP and Symfony versions. After cloning, please run composer install or composer update to install the appropriate package versions and Symfony recipes for your environment.
If you want to suppress the interactive recipe prompt ("Do you want to execute this recipe?"), use Composer with the --no-interaction flag.
First, you must register the application at https://www.discogs.com/applications/edit to get the consumer_key and
consumer_secret. You can set the values as environment variables. Then they will be used by both bundles. See also
calliostro/discogs-bundle.
Start the local web server of Symfony in the discogs-bundle-demo directory:
symfony serveOr use PHP's built-in server:
php -S 127.0.0.1:8000 -t publicOpen your web browser and visit the URL shown in the console output.
The demo provides the following routes to showcase different Discogs API features:
| Route | Method | Description |
|---|---|---|
/ |
GET | π Home page with user authentication info and navigation |
/search |
GET/POST | π Search the Discogs database for artists, releases, labels, etc. |
/artist/{id} |
GET | π΅ Display detailed artist information and releases |
/release/{id} |
GET | πΏ Display detailed release information including tracklist |
/label/{id} |
GET | π·οΈ Display detailed label information and releases |
/master/{id} |
GET | π― Display master release information and versions |
/collection |
GET | π View the authenticated user's Discogs collection |
/wantlist |
GET | π View the authenticated user's Discogs wantlist |
/profile |
GET | π€ View the authenticated user's complete Discogs profile |
/lists |
GET | π View the authenticated user's custom lists |
/list/{id} |
GET | π View items in a specific user list |
/marketplace |
GET | π Browse marketplace listings |
/orders |
GET | π¦ View and manage marketplace orders |
/inventory |
GET | π¦ View user's marketplace inventory |
/random |
GET | π² Discover random releases from popular artists |
π΅ Artist Details: /artist/8760 (Pink Floyd)
πΏ Release Details: /release/1 (First release in the Discogs database)
π·οΈ Label Details: /label/1 (Blue Note Records)
π Master Release: /master/5427 (Dark Side of the Moon)
π Search Examples
/search?q=Pink Floyd&type=artist/search?q=Abbey Road&type=release/search?q=Blue Note&type=label
Each route demonstrates different aspects of the Discogs API:
π Database search with filtering by type
π Pagination support
π Multiple search types (artist, release, label, master)
π€ getArtist() - Basic artist information
π½ getArtistReleases() - Artist's discography
πΌοΈ Artist images, aliases, and band members
π getRelease() - Complete release information
π΅ Tracklist with track details
π₯ Credits and contributors
π·οΈ Label information and identifiers
π’ getLabel() - Complete label information
π getLabelReleases() - Label's catalog
π Label statistics and history
π― getMaster() - Master release information
π getMasterVersions() - All versions and pressings
πΏ Format variations and differences
π getOAuthIdentity() - OAuth user authentication
π getCollectionFolders() - Collection organization
π getCollectionItemsByFolder() - Collection contents
π getWantlist() - User's wanted items
π€ getProfile() - Complete user profile with statistics
π getUserLists() - User's custom lists
π getLists() - List items and details
ποΈ List organization and management
π getInventory() - Marketplace listings
π¦ getOrders() - Order management
π° getOrder() - Detailed order information
π Marketplace statistics and insights
#[Route('/artist/{id}', name: 'artist_detail', methods: ['GET'])]
public function artistDetail(DiscogsClient $discogs, int $id): Response
{
$artist = $discogs->getArtist(['id' => $id]);
$artistReleases = $discogs->getArtistReleases(['id' => $id, 'per_page' => 10]);
return $this->render('artist_detail.html.twig', [
'artist' => $artist,
'releases' => $artistReleases
]);
}#[Route('/label/{id}', name: 'label_detail', methods: ['GET'])]
public function labelDetail(DiscogsClient $discogs, int $id): Response
{
$label = $discogs->getLabel(['id' => $id]);
$labelReleases = $discogs->getLabelReleases(['id' => $id, 'per_page' => 10]);
return $this->render('label_detail.html.twig', [
'label' => $label,
'releases' => $labelReleases
]);
}#[Route('/lists', name: 'user_lists', methods: ['GET'])]
public function userLists(DiscogsClient $discogs): Response
{
$identity = $discogs->getOAuthIdentity();
$userLists = $discogs->getUserLists([
'username' => $identity['username'],
'per_page' => 50
]);
return $this->render('user_lists.html.twig', [
'lists' => $userLists,
'username' => $identity['username']
]);
}#[Route('/marketplace', name: 'marketplace', methods: ['GET'])]
public function marketplace(DiscogsClient $discogs, Request $request): Response
{
$searchQuery = $request->query->get('q', '');
$listings = null;
if ($searchQuery) {
$searchResults = $discogs->search([
'q' => $searchQuery,
'type' => 'release',
'per_page' => 20
]);
$listings = $searchResults;
}
return $this->render('marketplace.html.twig', [
'listings' => $listings,
'searchQuery' => $searchQuery
]);
}π PHP 8 Attributes for routing (instead of annotations)
π Strong typing with proper return types
β‘ Exception handling with user-friendly error messages
ποΈ Modern PHP 8.1β8.5 compatibility
π¨ Bootstrap 5 for responsive design
π Interactive cards with hover effects
π§ Breadcrumb navigation for better user experience
π¬ Flash messages for user feedback
π Pagination for large result sets
π― Symfony 6.4 (LTS) - Long-term support
β‘ Symfony 7.x β Latest stable features
π§ͺ Symfony 8.0 (beta) - Cutting-edge features
π OAuth authentication flow
β±οΈ Rate limiting awareness
π‘οΈ Error handling for API failures
π Caching-friendly implementation
- Implement proper caching to reduce API calls
- Respect Discogs' rate limits (60 requests per minute for authenticated requests)
- Cache search results and static data (artists, releases, labels)
- Use appropriate cache TTL values (e.g., 24h for releases, 1h for dynamic data)
- Consider implementing request queuing for high-traffic applications
- Monitor your API usage through Discogs developer dashboard
Further documentation can be found at:
π Discogs API v2.0 Documentation
π¦ calliostro/discogs-bundle
π§ calliostro/php-discogs-api