Download the PHP package tafoyaventures/php-discogs-api without Composer
On this page you can find all versions of the php package tafoyaventures/php-discogs-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tafoyaventures/php-discogs-api
More information about tafoyaventures/php-discogs-api
Files in tafoyaventures/php-discogs-api
Package php-discogs-api
Short Description The Discogs API makes it easy for developers to communicate with the Discogs platform
License MIT
Informations about the package php-discogs-api
Discogs Api
This library is a PHP 7.4 implementation of the Discogs API v2.0. The Discogs API is a REST-based interface. By using this library you don't have to worry about communicating with the API: all the hard work has already be done.
This API is build upon the shoulders of a giant: Guzzle 7.0. This is an absolutely awesome library.
License
This library is released under the MIT license. See the complete license in the LICENSE file.
Installation
Start by installing composer. Next do:
$ composer require tafoyaventures/php-discogs-api
Requirements
PHP >=7.4.0
Usage
Creating a new instance is as simple as:
User-Agent
Discogs requires that you supply a User-Agent. You can do this easily:
Throttling
Discogs doesn't like it when you hit their API at a too high connection rate. Use the ThrottleSubscriber
to
prevent getting errors or banned:
Authentication
Discogs API allow to access protected endpoints with either a simple Discogs Auth Flow or a more advanced (and more complex) Oauth Flow
Discogs Auth
As stated in the Discogs Authentication documentation:
In order to access protected endpoints, you’ll need to register for either a consumer key and secret or user token, depending on your situation:
- To easily access your own user account information, use a User token.
- To get access to an endpoint that requires authentication and build 3rd party apps, use a Consumer Key and Secret.
With the Discogs Php API you can add your credentials to each request by adding a query
key to your own defaults like this:
Instead of query
use Authorization
header
Authenticate with Personal access token, you can get it from https://www.discogs.com/settings/developers
OAuth
There are a lot of endpoints which require OAuth. Lucky for you using Guzzle this is peanuts. If you're having trouble obtaining the token and token_secret, please check out my example implementation.
History
Another cool plugin is the History plugin:
More info and plugins
For more information about Guzzle and its plugins checkout the docs.
Perform a search:
Per august 2014 a signed OAuth request is required for this endpoint.
Get information about a label:
Get information about an artist:
Get information about a release:
Get information about a master release:
Get image
Discogs returns the full url to images so just use the internal client to get those:
User Collection
Authorization is required when folder_id
is not 0
.
Get collection folders
Get collection folder
Get collection items by folder
Listings
Creating and manipulating listings requires you to be authenticated as the seller
Create a Listing
Change Listing
Delete a Listing
Create Listings in bulk (via CSV)
Delete Listings in bulk (via CSV)
Documentation
Further documentation can be found at the Discogs API v2.0 Documentation.
Contributing
Implemented a missing call? PR's are welcome!
All versions of php-discogs-api with dependencies
guzzlehttp/guzzle Version ~7.0
guzzlehttp/guzzle-services Version ~1.2.0
guzzlehttp/oauth-subscriber Version ~0.4