mgoigfer / laravel-spotify-wrapper
A PHP wrapper for Spotify's Web API.
0.2.1
2018-11-27 11:20 UTC
Requires
- php: ^7.1
- jwilsson/spotify-web-api-php: ^2.6
Requires (Dev)
- larapack/dd: ^1.0
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-10-28 00:17:39 UTC
README
This is a PHP wrapper for jwilsson/spotify-web-api-php. It includes:
- Authorization flow helpers.
Installation
You can install this package via Composer:
composer require mgoigfer/laravel-spotify-wrapper
Add the following lines to config/services.php
:
'spotify' => [ 'client_id' => env('SPOTIFY_CLIENT_ID'), 'client_secret' => env('SPOTIFY_CLIENT_SECRET'), ],
Usage
$spotify = app()->make('SpotifyWrapper', [ 'callback' => '/playlist', ]);
Available options:
callback
: Optional. The URI to redirect to after the user grants or denies permission. This URI needs to have been entered in the Redirect URI whitelist that you specified when you registered your application.scope
: Optional. A space-separated list of scopes. If no scopes are specified, authorization will be granted only to access publicly available information.show_dialog
: Optional. Whether or not to force the user to approve the app again if they’ve already done so. Iffalse
(default), a user who has already approved the application may be automatically redirected to the URI specified by redirect_uri. Iftrue
, the user will not be automatically redirected and will have to approve the app again.
Method Reference
These are the available methods:
requestAccessToken
SpotifyWrapper\SpotifyWrapper::requestAccessToken()
Request an access token.
First of all, the user will be redirected to Spotify to approve the app. Then, the user is redirected back with an authorization code, in which we request an access token.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.