helgesverre / laravel-podscan
Laravel Client for the Podscan.fm API
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/helgesverre/laravel-podscan
Requires
- php: ^8.2|^8.3|^8.4
- saloonphp/laravel-plugin: ^3.5
- saloonphp/pagination-plugin: ^2.0
- saloonphp/saloon: ^3.8
- spatie/laravel-data: ^4.3.2
- spatie/laravel-package-tools: ^1.16.4
Requires (Dev)
- larastan/larastan: ^2.0.1|^3.0
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8|^8.0
- orchestra/testbench: ^8.8|^9.0|^10.0
- pestphp/pest: ^2.20|^3.0
- pestphp/pest-plugin-arch: ^2.0|^3.0
- pestphp/pest-plugin-laravel: ^2.0|^3.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0|^2.0
- phpstan/phpstan-phpunit: ^1.0|^2.0
README
Laravel Client for the Podscan.fm API
This package provides a simple and easy-to-use API client for the Podscan.fm API
Installation
You can install the package via composer:
composer require helgesverre/laravel-podscan
You can publish the config file with:
php artisan vendor:publish --tag="podscan-config"
This is the contents of the published config file:
return [ 'api_key' => env('PODSCAN_API_KEY'), ];
Add your API key to your .env file:
PODSCAN_API_KEY=your_api_key_here
You can generate your API key at https://podscan.fm/user/api-tokens.
Rate Limits
The Podscan API enforces rate limits based on your subscription plan:
| Plan | Daily Limit | Per Minute Limit |
|---|---|---|
| Trial | 100 requests | 10 requests |
| Essential | 1,000 requests | 60 requests |
| Premium | 2,000 requests | 120 requests |
| Enterprise | 5,000 requests | 120 requests |
Every API response includes the following headers:
X-RateLimit-Limit: Maximum requests allowed in a 60-minute periodX-RateLimit-Remaining: Requests remaining in the current rate limit window
Error Handling
This package uses Saloon's AlwaysThrowOnErrors plugin, which automatically throws exceptions for 4xx and 5xx HTTP responses.
use Saloon\Exceptions\Request\FatalRequestException; use Saloon\Exceptions\Request\RequestException; try { $response = Podscan::podcasts()->get('podcast-id'); } catch (FatalRequestException $e) { // Handle 4xx errors (client errors) echo "Client error: " . $e->getMessage(); } catch (RequestException $e) { // Handle 5xx errors (server errors) echo "Server error: " . $e->getMessage(); }
Usage
Client Instantiation
Create an instance of the Podscan client to start interacting with the API. This instance will be your primary interface for sending requests to Podscan.AI.
use HelgeSverre\Podscan\Podscan; // Instantiate the client $podscan = new Podscan(apiKey: config('podscan.api_key')); // Or use the Facade (Laravel) Podscan::alerts(); Podscan::category(); Podscan::charts(); Podscan::episodes(); Podscan::podcasts(); Podscan::teams();
Resources
Alerts
Podscan::alerts()->list(); Podscan::alerts()->create(); Podscan::alerts()->get(); Podscan::alerts()->update(); Podscan::alerts()->delete(); Podscan::alerts()->mentions(); Podscan::alerts()->mention();
Categories
Podscan::categories()->list();
Charts
// Get countries with current chart data Podscan::charts()->availableCountries(); // Get all supported countries Podscan::charts()->supportedCountries(); // Get available categories for a platform and country Podscan::charts()->categories('apple', 'US'); Podscan::charts()->categories('spotify', 'GB'); // Get chart data for a specific category Podscan::charts()->categoryData('apple', 'US', 'technology'); Podscan::charts()->categoryData('spotify', 'GB', 'comedy');
Episodes
Podscan::episodes()->search(); Podscan::episodes()->paginatedSearch(); Podscan::episodes()->recent(); Podscan::episodes()->get();
Podcasts
Podscan::podcasts()->suggest(); Podscan::podcasts()->search(); Podscan::podcasts()->paginatedSearch(); Podscan::podcasts()->get(); Podscan::podcasts()->episodes(); Podscan::podcasts()->paginatedEpisodes();
Teams
Podscan::teams()->list();
Testing
cp .env.example .env
composer test
composer analyse src
License
The MIT License (MIT). Please see License File for more information.
Disclaimer
Podscan and the Podscan logo are trademarks of Arvid Kahl. This package is not affiliated with Podscan or Arvid Kahl in any way.
