GenreHandler
extends BaseHandler
in package
Table of Contents
Properties
- $accessToken : string|null
- $baseUrl : string
- $client : Client
- $credentialService : SpotifyCredentialService|null
Methods
- __construct() : mixed
- getAlbumsByGenre() : array<string|int, mixed>
- Get multiple albums by genre (using search with genre filters)
- getArtistsByGenre() : array<string|int, mixed>
- Get artists by genre (using search with genre filters)
- getAvailableGenreSeeds() : array<string|int, mixed>
- Get a list of genres used to tag items in Spotify
- getCategories() : array<string|int, mixed>
- Get categories (which often represent genres/moods)
- getCategoryPlaylists() : array<string|int, mixed>
- Get playlists for a specific category
- getFeaturedPlaylists() : array<string|int, mixed>
- Get featured playlists (often organized by genre/mood)
- getNewReleases() : array<string|int, mixed>
- Get new releases (can be filtered by genre through search)
- getPlaylistsByGenre() : array<string|int, mixed>
- Get playlists by genre (using search with genre filters)
- getRecommendationsByGenre() : array<string|int, mixed>
- Get recommendations based on genre seeds
- getTracksByGenre() : array<string|int, mixed>
- Get tracks by genre (using search with genre filters)
- setAccessToken() : void
- Set the access token
- setCredentialService() : void
- Set the credential service
- getAccessToken() : string|null
- Get the current access token
- getAuthHeaders() : array<string|int, mixed>
- Get authorization headers
- makeRequest() : array<string|int, mixed>
- Make an authenticated request
Properties
$accessToken
protected
string|null
$accessToken
= null
$baseUrl read-only
protected
string
$baseUrl
$client read-only
protected
Client
$client
$credentialService
protected
SpotifyCredentialService|null
$credentialService
= null
Methods
__construct()
public
__construct(Client $client, string $baseUrl) : mixed
Parameters
- $client : Client
- $baseUrl : string
getAlbumsByGenre()
Get multiple albums by genre (using search with genre filters)
public
getAlbumsByGenre(string $genre[, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ][, string|null $year = null ]) : array<string|int, mixed>
Parameters
- $genre : string
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
- $year : string|null = null
Return values
array<string|int, mixed>getArtistsByGenre()
Get artists by genre (using search with genre filters)
public
getArtistsByGenre(string $genre[, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ]) : array<string|int, mixed>
Parameters
- $genre : string
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
Return values
array<string|int, mixed>getAvailableGenreSeeds()
Get a list of genres used to tag items in Spotify
public
getAvailableGenreSeeds() : array<string|int, mixed>
Return values
array<string|int, mixed>getCategories()
Get categories (which often represent genres/moods)
public
getCategories([string|null $country = null ][, string|null $locale = null ][, int $limit = 20 ][, int $offset = 0 ]) : array<string|int, mixed>
Parameters
- $country : string|null = null
- $locale : string|null = null
- $limit : int = 20
- $offset : int = 0
Return values
array<string|int, mixed>getCategoryPlaylists()
Get playlists for a specific category
public
getCategoryPlaylists(string $categoryId[, string|null $country = null ][, int $limit = 20 ][, int $offset = 0 ]) : array<string|int, mixed>
Parameters
- $categoryId : string
- $country : string|null = null
- $limit : int = 20
- $offset : int = 0
Return values
array<string|int, mixed>getFeaturedPlaylists()
Get featured playlists (often organized by genre/mood)
public
getFeaturedPlaylists([string|null $country = null ][, int $limit = 20 ][, int $offset = 0 ][, string|null $timestamp = null ]) : array<string|int, mixed>
Parameters
- $country : string|null = null
- $limit : int = 20
- $offset : int = 0
- $timestamp : string|null = null
Return values
array<string|int, mixed>getNewReleases()
Get new releases (can be filtered by genre through search)
public
getNewReleases([string|null $country = null ][, int $limit = 20 ][, int $offset = 0 ]) : array<string|int, mixed>
Parameters
- $country : string|null = null
- $limit : int = 20
- $offset : int = 0
Return values
array<string|int, mixed>getPlaylistsByGenre()
Get playlists by genre (using search with genre filters)
public
getPlaylistsByGenre(string $genre[, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ]) : array<string|int, mixed>
Parameters
- $genre : string
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
Return values
array<string|int, mixed>getRecommendationsByGenre()
Get recommendations based on genre seeds
public
getRecommendationsByGenre(array<string|int, mixed> $genreSeeds[, int $limit = 20 ][, string|null $market = null ][, array<string|int, mixed> $targetAudioFeatures = [] ]) : array<string|int, mixed>
Parameters
- $genreSeeds : array<string|int, mixed>
- $limit : int = 20
- $market : string|null = null
- $targetAudioFeatures : array<string|int, mixed> = []
Return values
array<string|int, mixed>getTracksByGenre()
Get tracks by genre (using search with genre filters)
public
getTracksByGenre(string $genre[, int $limit = 20 ][, int $offset = 0 ][, string|null $market = null ][, string|null $year = null ]) : array<string|int, mixed>
Parameters
- $genre : string
- $limit : int = 20
- $offset : int = 0
- $market : string|null = null
- $year : string|null = null
Return values
array<string|int, mixed>setAccessToken()
Set the access token
public
setAccessToken(string|null $accessToken) : void
Parameters
- $accessToken : string|null
setCredentialService()
Set the credential service
public
setCredentialService(SpotifyCredentialService $credentialService) : void
Parameters
- $credentialService : SpotifyCredentialService
getAccessToken()
Get the current access token
protected
getAccessToken() : string|null
Return values
string|nullgetAuthHeaders()
Get authorization headers
protected
getAuthHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>makeRequest()
Make an authenticated request
protected
makeRequest(string $method, string $endpoint[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $method : string
- $endpoint : string
- $options : array<string|int, mixed> = []