PHP code example of apimatic-spotify / spotify-apimatic-sdk

1. Go to this page and download the library: Download apimatic-spotify/spotify-apimatic-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

apimatic-spotify / spotify-apimatic-sdk example snippets


use SpotifyWebAPILib\Environment;
use SpotifyWebAPILib\Authentication\AuthorizationCodeAuthCredentialsBuilder;
use SpotifyWebAPILib\Models\OAuthScopeEnum;
use SpotifyWebAPILib\SpotifyWebAPIClientBuilder;

$client = SpotifyWebAPIClientBuilder::init()
    ->authorizationCodeAuthCredentials(
        AuthorizationCodeAuthCredentialsBuilder::init(
            'OAuthClientId',
            'OAuthClientSecret',
            'OAuthRedirectUri'
        )
            ->oAuthScopes(
                [
                    OAuthScopeEnum::APP_REMOTE_CONTROL,
                    OAuthScopeEnum::PLAYLIST_READ_PRIVATE
                ]
            )
    )
    ->environment(Environment::PRODUCTION)
    ->build();