ashbakernz / laravel-dashboard-spotify-tile
Displays data from spotfiy on a tile for spatie/laravel-dashboard
Requires
- php: ^7.4
- spatie/laravel-dashboard: ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.0
README
This tile displays "now playing" infomation from spotify.
This tile can be used on the Laravel Dashboard.
Installation
You can install the package via composer:
composer require ashbakernz/laravel-dashboard-spotify-tile
In the dashboard config file, you must add this configuration in the tiles key.
'spotify' => [ 'client_id' => env('SPOTIFY_CLIENT_ID'), 'secret' => env('SPOTIFY_SECRET'), 'refresh_interval_in_seconds' => 60, ]
Getting SPOTIFY_CLIENT_ID
and SPOTIFY_SECRET
Sign up at https://developer.spotify.com/dashboard and register your application to obtain SPOTIFY_CLIENT_ID
and SPOTIFY_SECRET
.
Once you have setup your application please go to the spotify dashboard, select your application and click "EDIT SETTINGS" in the top right. You will then need to add the following urls based on your environments to the "Redirect URIs " section and then hit save. This will allow us to authenticate correctly in the next step.
Redirect URI example:
https://yourdomain.com/spotify/callback
In your dashboard view you use the livewire:spotify-tile
component.
<x-dashboard> <livewire:spotify-tile position="a1:a1" /> </x-dashboard>
Once this is complete please head to the /spotify/authorize
route on your dashboard in a browser and this will allow you to authenicate your spotify account.
In app\Console\Kernel.php
you should schedule the following commands.
protected function schedule(Schedule $schedule) { // ... $schedule->command(\Ashbakernz\SpotifyTile\FetchDataFromSpotifyCommand::class)->everyMinute(); $schedule->command(\Ashbakernz\SpotifyTile\RefreshAccessTokenSpotifyCommand::class)->everyFifteenMinutes(); }
Setup is complete!
Bugs
If the tile is displaying incorrectly please head to the /spotify/refresh
route in a browser to refresh your spotify access token manually. (a command is already setup to do this every 30 mins via scheduler)
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email ashbakernz@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.