PHP code example of tokenly / music-api-client

1. Go to this page and download the library: Download tokenly/music-api-client 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/ */

    

tokenly / music-api-client example snippets


// login with the public API client
$public_tokenly_api = new Tokenly\APIClient\TokenlyAPI('https://music-stage.tokenly.com/api/v1');
$public_music_api = new Tokenly\MusicClient\MusicAPI($public_tokenly_api);
$user_details = $public_music_api->login('myusername', 'mypassword');
$client_id = $user_details['apiToken'];
$secret_key = $user_details['apiSecretKey'];

// Once you have the client id and key, you can use the protected API client to call protected methods
$protected_tokenly_api = new Tokenly\APIClient\TokenlyAPI('https://music.tokenly.com/api/v1', new Tokenly\HmacAuth\Generator(), $client_id, $secret_key);
$protected_music_api = new Tokenly\MusicClient\MusicAPI($protected_tokenly_api);
$songs_array = $protected_music_api->getMySongs();