Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.89 KB

README.md

File metadata and controls

59 lines (42 loc) · 1.89 KB

musicBrainzPHP

PHP library for retrieving CD information from musicBrainz API.
Retrieve most of the information you can see on musicBrainz page of specific title.
Search for titles on musicBrainz by barcode, artist or title
Get front and back cover art image urls. from coverartarchive.org
Search is default for CD (change in config).
All info is in the wikipages, every class and method is described there!

Quick Start

  • If you're not using composer or an autoloader include bootstrap.php.
  • Search for cd title, artist or barcode
$music = new \Music\TitleSearch();
$results = $music->search("", "", "724383065820"); // example with barcode (title and artist are ignored)
$results = $music->search("who made who", "AC/DC", ""); // example with CD title and artist
$results = $music->search("who made who", "", ""); // example with CD title only
$results = $music->search("", "AC/DC", ""); // example with artist only

Installation

This library uses musicBrainz API.

Get the files with one of:

  • Git clone. Checkout the latest release tag.
  • [Zip/Tar download]

Requirements

  • PHP >= 7.4 - 8.1 (all versions < 8.0 are end of life)
  • PHP cURL extension

Options

musicBrainz has a few options in config:

Default user agent (this must be something that identifies the user and program!) possible ban!
Default search: CD (this can be others too like vinyl)
Default search limit: 25 (range = 1-100 including 1 and 100)

Fetching data from a title

include "bootstrap.php"; // Load the class if you're not using an autoloader
$music = new \Music\Title("095e2e2e-60c4-4f9f-a14a-2cc1b468bf66"); // parameter is the found musicBrainz id from search)
$results = $music->fetchData(); // This returns a array with all available info of this title

Credits to imdbphp, musicBrainzPHP is loosly based on it.