PHP code example of stephan-strate / php-cover-art-archive-api

1. Go to this page and download the library: Download stephan-strate/php-cover-art-archive-api 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/ */

    

stephan-strate / php-cover-art-archive-api example snippets


$client = new \CoverArtArchive\Client();

$repository = new \CoverArtArchive\Repository\ReleaseGroupRepository($client);
$repository->coverArt('19e6209b-2ddc-30b8-9273-484bd075fe7b');

$repository = new \CoverArtArchive\Repository\ReleaseRepository($client);
$image = $repository->coverArtFront('7416e707-94b5-3810-b6b8-4229ab2182ec');

// outputs the image to the user
if ($image !== false) {
    header('Content-Type: image/png');
    imagepng($image);
    imagedestroy($image);
}

$release = $client->release();
$release->coverArt('7416e707-94b5-3810-b6b8-4229ab2182ec');

$ composer