pkboom / spotify-apis
dev-master
2019-03-11 21:46 UTC
Requires
- php: ^7.1
- kitetail/zttp: ^0.4.0
Requires (Dev)
- phpunit/phpunit: ^7.0
- symfony/var-dumper: ^4.2
This package is auto-updated.
Last update: 2024-11-12 10:18:05 UTC
README
Installation
composer require pkboom/spotify-apis
Create shopify client id
Go to 'EDIT SETTING' -> Register Redirect a URI
Publish config-file and set it up
php artisan vendor:publish --provider="Pkboom\SpotifyApis\SpotifyApisServiceProvider"
Create a callback route
// Example Route::get('callback', function() { SpotifyApis::callback(); });
Usage
// Controller use Pkboom\SpotifyApis; class SpotifyApisController extends Controller { public function login() { SpotifyApis::login(); } public function callback() { SpotifyApis::callback(); } public function refreshToken() { SpotifyApis::refreshToken(); } public function getArtist($artist) { return SpotifyApis::getArtist($artist); } public function getMe() { return SpotifyApis::getMe(); } public function search() { return SpotifyApis::search('bts', 'artist'); } // Route Route::get('spotify/login', 'SpotifyApisController@login'); Route::get('spotify/callback', 'SpotifyApisController@callback'); Route::get('spotify/refresh_token', 'SpotifyApisController@refreshToken'); Route::get('spotify/artists/{artist}', 'SpotifyApisController@getArtist'); Route::get('spotify/me', 'SpotifyApisController@getMe'); Route::get('spotify/search', 'SpotifyApisController@search');
You could easily extend the class to create new methods
use Pkboom\SpotifyApis as Spotify; class SpotifyApis extends Spotify { public function getAlbum($album) { $params = [ 'ids' => $album ]; return static::getInfo('albums', $params); } }
License
The MIT License (MIT). Please see MIT license for more information.