/LastFM-PHP

LastFM PHP is an easier way for developers to access the LastFM API.

Primary LanguagePHP

LastFM-PHP

LastFM PHP is an easier way for developers to access the LastFM API. Forked from https://github.com/Crucider/LastFM-PHP

How to Use

You must require the class inside of your PHP file. The class can be found here: https://github.com/Kiwithing/LastFM-PHP/blob/master/lastfm.php

require 'lastfm.php';

To start the class, you have to add in Options (remember this for later on).

$lastfm = new LastFM(array(
	'USER' => 'Username Here',
	'APIKEY' => 'API Key Here'
));

Options available:

  • USER
  • APIKEY

Functions:

getSongs() - Grabs recently played songs

Parameters:

  • Limit
    • Integer. (Default = 5) Amount of songs to grab.

Requirements:

  • Options
    • USER

Example:

foreach($lastfm->getSongs(5) as $song) {
	echo $song['NAME'] . ' by ' . $song['ARTIST'] . '<br>';
}

getCustom() - Access the other API's that aren't available yet

Parameters:

Requirements:

  • Options
    • APIKEY
  • Parameters
    • Method
    • Parameters

Example:

$lastfm->getCustom('album.getinfo', array(
	'artist' => 'Beast',
	'album' => 'Fiction And Fact'
));