Download the PHP package aerni/laravel-spotify without Composer
On this page you can find all versions of the php package aerni/laravel-spotify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-spotify
Spotify for Laravel
An easy to use Spotify Web API wrapper for Laravel
Installation •
Usage Example •
Optional Parameters •
Spotify API Reference •
Introduction
Spotify for Laravel makes working with the Spotify Web API a breeze. It provides straight forward methods for each endpoint and a fluent interface for optional parameters.
The package supports all Spotify Web API endpoints that are accessible with the Client Credentials Flow.
Installation
Install the package using Composer. The package will automatically register itself.
Publish the config of the package.
The following config will be published to config/spotify.php
.
Set the Client ID
and Client Secret
of your Spotify App in your .env
file.
Usage Example
Import the package at the top of your file. All of the following examples use the Facade.
Search for tracks with the name Closed on Sunday
.
Important: The get()
method acts as the final method of the fluent interface. Make sure to always call it last in the method chain to execute a request to the Spotify Web API.
Optional Parameters
You may pass optional parameters to your requests using the fluent interface provided by this package. A common use case is to set a limit
and offset
to your request.
Parameter Methods API Reference
Consult the Spotify Web API Reference Documentation to check which parameters are available to what endpoint.
Resetting Defaults
You may want to reset the default setting of country
, locale
or market
for a given request. You may do so by calling the corresponding parameter method with an empty argument.
Response Key
Some API responses are wrapped in a top level object like artists
or tracks
. If you want to directly access the content of a given top level object, you may do so by passing its key as a string to the get()
method.
Spotify API Reference
Note: Any parameter that accepts multiple values can either receive a string with comma-separated values or an array of values.
Albums
Artists
Browse
Episodes
Playlists
Search
Shows
Tracks
User's Profile
Tests
Run the tests like this: