calliostro/last-fm-client-bundle
Symfony bundle that integrates the modern calliostro/lastfm-client with autowiring and Guzzle. Configure your API key, secret, session key, user agent, and optional rate limiter to access Last.fm music data and scrobbling.
The package continues to align closely with modern Laravel/Symfony ecosystems, and v2.1.0 reinforces that alignment by pushing resilience concerns into the underlying client:
calliostro/lastfm-client v2.1 adds built-in retry handling for Last.fm rate limits (429) and server overload (503). This shifts retry logic out of application code and into the client, reducing the custom wrapper surface a Laravel team would otherwise own.auto_retry (default true) and max_retries (default 3) options in calliostro_lastfm expose retry behavior as configuration rather than code — a TPM-friendly control knob for production tuning.Key Fit for Laravel:
calliostro_lastfm) maps to Laravel's config/lastfm.php; the new auto_retry/max_retries keys should be mirrored in the Laravel config file.High for greenfield projects or those willing to migrate. v2.1.0 is a minor, non-breaking release over v2.0.0, so teams already mid-migration can consume it without re-scoping. Breaking changes from v1.x remain scoped to:
calliostro/lastfm-client v2.1 replaces the older API wrapper; actively maintained, feature-complete, and now with built-in retry.auto_retry, max_retries) can be added without code changes.bind() or extend() methods can replicate Symfony's autowiring if needed.Challenges:
new LastFM()) will require refactoring to use both the container and the retry-enabled client.lastfm.*) will need alignment with calliostro_lastfm.*, including the new retry keys.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Breaking Changes | High | Dedicate 1–2 sprints for migration; use UPGRADE.md as a checklist. |
| Dependency Versioning | Medium | Pin calliostro/lastfm-client v2.1 in composer.lock; test in staging. |
| Rate Limiting / Retries | Low | Built-in retry on 429/503 via auto_retry + max_retries; tune values per environment. |
| PHP 8.1+ Requirements | Medium | Upgrade PHP if <8.1; validate with phpstan:8 (Level 8 config now shipped). |
| Symfony-Specific Abstractions | Low | Abstract Symfony dependencies behind interfaces; retry logic is now client-side. |
| Retry Duplication | Low | Audit existing retry middleware; disable one layer to avoid compounding backoff. |
calliostro/lastfm-client v2.1's retry behavior interact with Laravel middleware-level retries? (Answer: Pick one retry owner — built-in client retry preferred; disable middleware duplication.)config/lastfm.php expose auto_retry/max_retries alongside credentials, or should these be env-driven per tier? (Recommend: env-driven with sane defaults.)max_retries) add measurable overhead in worst-case scenarios? (Benchmark under simulated 503s.)| Component | Laravel Compatibility | Notes |
|---|---|---|
| Autowiring | High | Laravel's container supports type-hinted DI; use app()->bind() if needed. |
| Configuration | Medium | YAML config maps to Laravel's config/lastfm.php; add auto_retry and max_retries. |
| Rate Limiting / Retry | High | Built-in client retry on 429/503; optional Laravel RateLimiter for outbound protection. |
| PHP 8.1–8.6 | High | Laravel 9+/10+ support; CI matrix confirms 8.1–8.6. |
| Symfony 6.4–8.2 | Low-Medium | Not natively Laravel-compatible; abstract or bridge where Symfony abstractions leak. |
Pre-Migration:
calliostro/php-lastfm-api and LastFM service usages, including any app-level retry logic.Core Migration:
calliostro/php-lastfm-api with calliostro/lastfm-client v2.1 (via calliostro/last-fm-client-bundle v2.1.0).// Before (v1.x)
$lastfm = new \LastFM\Api\Client($config);
// After (v2.1)
$lastfm = $this->container->get(LastFmClient::class); // Autowired
lastfm.* to calliostro_lastfm.*; add auto_retry: true and max_retries: 3 (or tuned values).Post-Migration:
mllrsohn/laravel-lastfm) and with any existing retry middleware.auto_retry/max_retries.getUserInfo) and a forced 429 response.calliostro_lastfm keys (including auto_retry, max_retries) may conflict with existing Laravel config keys.var_dumper for complex data (install via symfony/var-dumper).app()->bind() for custom service extensions.max_retries.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| API Key Revocation | High | Implement key rotation in config; use Laravel's env() for dynamic keys. |
| Sustained 429 / 503 | Medium (now reduced) | Built-in retry via auto_retry + max_retries; tune per environment; alert on exhausted retries. |
| Dependency Version Conflict | Medium | Pin v2.1 in composer.lock; test with phpunit before deploy. |
| Configuration Errors | Low-Medium | Validate config on boot (e.g., booted event); validate max_retries bounds. |
| Retry Storm / Duplication | Low-Medium | Ensure only one retry layer (client or middleware) is active. |
| PHP/Symfony Bugs | Low | Monitor calliostro/lastfm-client releases. |
UPGRADE.md, and the new phpstan.neon.dist as a correctness reference.auto_retry/max_retries behavior before rolling to staging.How can I help you explore Laravel packages today?