polr-api-client is a lightweight REST client for Polr (a self-hosted link-in-bio service), making it ideal for:
Illuminate\Support\ServiceProvider), DI, and HTTP clients.composer require adeelnawaz/polr-api-client).
config/app.php and bind it to Laravel’s container.Polr) to abstract API calls (e.g., Polr::fetchLinks()).Link Eloquent model)..env for Polr API base URL and auth tokens.PolrService class to handle API calls (e.g., getUserLinks(), createLink()).LinkCreated).Cache::remember()).Log::channel('polr')).Http::fake() in Laravel).dd() or dump() to inspect raw API responses.HTTP_CLIENT_DEBUG=true in .env for verbose logs.Cache::tags(['user:123'])).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Polr API downtime | Link redirections fail | Fallback to static HTML/JS redirects; notify users. |
| Auth token expiration | All API calls fail | Implement token refresh logic (e.g., Polr::refreshToken()). |
| Rate limiting | Throttled requests | Add retry logic with jitter; cache responses aggressively. |
| Polr API schema change | App breaks | Use feature flags to toggle old/new API versions; fork the client if needed. |
| Data corruption | Invalid links in DB | Validate Polr responses against Laravel models; use transactions for writes. |
README for the team covering:
Polr::getLinks($userId)).try/catch with PolrException).How can I help you explore Laravel packages today?