calliostro / discogs-bundle
Symfony bundle for the Discogs API — vinyl, music data & integration made easy
Installs: 405
Dependents: 0
Suggesters: 2
Security: 0
Stars: 2
Watchers: 1
Forks: 9
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^8.1
- calliostro/php-discogs-api: v4.0.0-beta.1
- symfony/config: ^6.4|^7.0|^8.0
- symfony/dependency-injection: ^6.4|^7.0|^8.0
- symfony/http-kernel: ^6.4|^7.0|^8.0
- symfony/security-core: ^6.4|^7.0|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.87
- phpstan/phpstan: ^2.1
- symfony/phpunit-bridge: ^6.4|^7.0|^8.0
This package is auto-updated.
Last update: 2025-09-12 11:03:44 UTC
README
🚀 Seamless integration of calliostro/php-discogs-api into Symfony 6.4, 7, and 8.
Use v4.0.0 for new projects with modern tooling and breaking changes. Legacy support for v3.x continues on the
legacy/v3.x
branch.
⚡ Requirements
- PHP: 8.1 or higher
- Symfony: 6.4, 7.x, or 8.x
📦 Installation
Symfony Flex (Recommended)
composer require calliostro/discogs-bundle
Without Symfony Flex
1️⃣ Install the Bundle
composer require calliostro/discogs-bundle
2️⃣ Register the Bundle
Add to config/bundles.php
:
// config/bundles.php return [ // ...existing bundles... Calliostro\DiscogsBundle\CalliostroDiscogsBundle::class => ['all' => true], ];
🎸 Usage
The bundle provides a DiscogsClient
service for autowiring:
// src/Controller/MusicController.php use Discogs\DiscogsClient; class MusicController { public function getArtist(DiscogsClient $discogs): Response { $artist = $discogs->getArtist(['id' => 8760]); return new JsonResponse([ 'name' => $artist['name'], 'profile' => $artist['profile'] ?? null, ]); } }
⚙️ Configuration
Create config/packages/calliostro_discogs.yaml
:
# config/packages/calliostro_discogs.yaml calliostro_discogs: # Required: HTTP User-Agent header for API requests user_agent: 'MyApp/1.0 +https://myapp.com' # Recommended: Your application credentials from discogs.com/applications consumer_key: ~ consumer_secret: ~ # Rate limiting configuration throttle: enabled: true microseconds: 1000000 # Wait time when the rate limit is hit # OAuth 1.0a authentication (for user-specific data) oauth: enabled: false token_provider: calliostro_discogs.hwi_oauth_token_provider
🔐 Authentication
Basic Authentication (Recommended)
Register your app at Discogs Applications to get:
consumer_key
consumer_secret
This enables access to protected endpoints and higher rate limits. 🚦
OAuth 1.0a (Optional)
For user-specific data, OAuth 1.0a is supported via HWIOAuthBundle:
# config/packages/calliostro_discogs.yaml calliostro_discogs: oauth: enabled: true # token_provider: calliostro_discogs.hwi_oauth_token_provider # Default, no need to specify
🛡️ Custom Token Provider
Implement OAuthTokenProviderInterface
for custom OAuth token handling:
use Calliostro\DiscogsBundle\OAuthTokenProviderInterface; class CustomTokenProvider implements OAuthTokenProviderInterface { public function getToken(): string { // Return OAuth token } public function getTokenSecret(): string { // Return OAuth token secret } }
📖 Documentation
- API Client: See calliostro/php-discogs-api
- Discogs API: Official Documentation
- Example Application: discogs-bundle-demo
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Please ensure your code follows Symfony coding standards and includes tests.
📄 License
This project is licensed under the MIT License — see the LICENSE file for details.
🙏 Acknowledgments
- Discogs for providing the excellent music database API
- ricbra/RicbraDiscogsBundle for the original inspiration
⭐ Star this repo if you find it useful! It helps others discover this lightweight solution.