PHP code example of matchtune-sdk / php-sdk

1. Go to this page and download the library: Download matchtune-sdk/php-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/ */

    

matchtune-sdk / php-sdk example snippets




use MatchTune\MatchTune;

$api = new MatchTune(["app_token" => $app_token]);

$haserror = true;
// -- Load genre & subgenre list
if ($genres = $api->genres()) {

  // -- pick a random genre
  $genre = $genres[array_rand($genres)];

  // -- create a search query
  $query = $api->makeQuery($genre, $title = null, $tags = null);

  // -- request a standard generated music
  if ($idcard = $api->generate($query)) {
    $haserror = false;

    // -- use the data
    printIDCard($idcard);
  }
}