Download the PHP package dnklbgn/oauth2-spotify without Composer
On this page you can find all versions of the php package dnklbgn/oauth2-spotify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dnklbgn/oauth2-spotify
More information about dnklbgn/oauth2-spotify
Files in dnklbgn/oauth2-spotify
Package oauth2-spotify
Short Description Spotify OAuth 2.0 Client Provider for The PHP League OAuth2-Client
License MIT
Informations about the package oauth2-spotify
Spotify Provider for OAuth 2.0 Client
This package provides Spotify OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
Requirements
The following versions of PHP are supported:
- PHP 8.3
Please follow the Spotify instructions to create the app and obtain the required credentials.
Installation
You can install this package using Composer:
Or you can add the following to your composer.json
file:
Usage
Authorization Code Flow
Managing Scopes
When creating your Spotify authorization URL, you can specify the state and scopes your application may authorize.
If neither are defined, the provider will utilize internal defaults. At the time of authoring this documentation, the following scopes are available.
- Images
- ugc-image-upload (
SpotifyScope::UGS_IMAGE_UPLOAD
)
- ugc-image-upload (
- Spotify Connect
- user-read-playback-state (
SpotifyScope::USER_READ_PLAYBACK_STATE
) - user-modify-playback-state (
SpotifyScope::USER_MODIFY_PLAYBACK_STATE
) - user-read-currently-playing (
SpotifyScope::USER_READ_CURRENTLY_PLAYING
)
- user-read-playback-state (
- Playback
- app-remote-control (
SpotifyScope::APP_REMOTE_CONTROL
) - streaming (
SpotifyScope::STREAMING
)
- app-remote-control (
- Playlists
- playlist-read-private (
SpotifyScope::PLAYLIST_READ_PRIVATE
) - playlist-read-collaborative (
SpotifyScope::PLAYLIST_READ_COLLABORATIVE
) - playlist-modify-private (
SpotifyScope::PLAYLIST_MODIFY_PRIVATE
) - playlist-modify-public (
SpotifyScope::PLAYLIST_MODIFY_PUBLIC
)
- playlist-read-private (
- Follow
- user-follow-modify (
SpotifyScope::USER_FOLLOW_MODIFY
) - user-follow-read (
SpotifyScope::USER_FOLLOW_READ
)
- user-follow-modify (
- Listening History
- user-read-playback-position (
SpotifyScope::USER_READ_PLAYBACK_POSITION
) - user-top-read (
SpotifyScope::USER_TOP_READ
) - user-read-recently-played (
SpotifyScope::USER_READ_RECENTLY_PLAYED
)
- user-read-playback-position (
- Library
- user-library-modify (
SpotifyScope::USER_LIBRARY_MODIFY
) - user-library-read (
SpotifyScope::USER_LIBRARY_READ
)
- user-library-modify (
- Users
- user-read-email (
SpotifyScope::USER_READ_EMAIL
) - user-read-private (
SpotifyScope::USER_READ_PRIVATE
)
- user-read-email (
- Open Access
- user-soa-link (
SpotifyScope::USER_SOA_LINK
) - user-soa-unlink (
SpotifyScope::USER_SOA_UNLINK
) - user-manage-entitlements (
SpotifyScope::USER_MANAGE_ENTITLEMENTS
) - user-manage-partner (
SpotifyScope::USER_MANAGE_PARTNER
) - user-create-partner (
SpotifyScope::USER_CREATE_PARTNER
)
- user-soa-link (
Retrieving Spotify user information
The getResourceOwner()
method will return an instance of \Dnklbgn\OAuth2\Client\Provider\SpotifyResourceOwner
,
which has some helpful getter methods to access basic authorized user details.
Refreshing a Token
If your access token expires you can refresh them with the refresh token.
Contributing
Contributions are welcome and will be fully credited. Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.