PHP code example of jolitagrazyte / discogs-api

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

    

jolitagrazyte / discogs-api example snippets


$discogs = new DiscogsApi('discogs-token', 'app-name');

//get orders
$orders = $discogs->getMyOrders();

/**
* get orders with parameters: 
* in this example page = 3, perPage = 25, status = shipped, sort = created, sortOrder = desc
*/
$ordersWithOptions = $discogs->getMyOrders(3, 25, "shipped", "created", "desc");

$discogs = new DiscogsApi('discogs-token', 'app-name');

//get messages  of an order with id
$ordersMessages = $discogs->orderMessages('123');

$discogs = new DiscogsApi('discogs-token', 'app-name');

//change order status to 'Shipped'
$orders = $discogs->changeOrderStatus('123', 'Shipped');

//add shipping to an order with id
$order = $discogs->addShipping('123', '12.60');

$discogs = new DiscogsApi('discogs-token', 'app-name');

// create a SearchParameters object and chain some search paramater
$searchParameters = SearchParameters::make()->format('LP')->year('1996');

//do a search request with a query = 'MoWax' and passing the SearchParameters object
$searchResult = $discogs->search('MoWax', $searchParameters);
 php
$discogs = new DiscogsApi();

//get artist with id 1
$artist = $discogs->artist('1');

//get releases of the artist with id 1
$artistReleases = $discogs->artistReleases('1');

//get label with id 1 
$label = $discogs->label('1');

//get releases of the label with id 1
$labelReleases = $discogs->labelReleases('1');

//get release with id 1
$releases = $discogs->releases('1');

//get master release with id 1
$masterRelease = $discogs->masterRelease('1');