By : Fritz321 Published On Tuesday, October 28, 2014, 14:52 In PHP Scripts

The LastFM Music Engine is an easy lightweight class that makes it simple to integrate and process music info from last fm. The class supports Trending music, Artists search, Track search, Album search & Artist info (toptracks, bio, tags, similar artists).
The class has the following functions:
Easy install
- STEP 1 (set your api key)
const APIKEY = 'YOUR_API_KEY';
- STEP 2 (Include & initalize class)
include_once('lastfm.class.php');
$lstfm = new Lastfm();
Class functions:
$lstfm->trendingTracks('Belgium'); //gets the trending tracks based on a country
$lstfm->trendingArtists('Belgium', 10); //gets the trending artists based on a country limited to 10 items (limit parameter)
$lstfm->searchTracks('Soldier'); //searchs tracks based on a search term
$lstfm->searchArtists('Marco Bai') //searchs artists based on a search term
$lstfm->searchArtists('Marco Bai', 20) // same with a limit of 20 results
$lstfm->searchAlbums('Half power'); //searchs albums based on the given term
$lstfm->searchArtistInfo('Eminem', array('toptracks', 'bio')); //gets the toptracks, bio (bio text, tags & similar artists) based on a full artist name
$lstfm->showHtmlList($array, 'type'); //returns an styled unorderd (ul) html list (supports types: artists/tracks/albums)
$lstfm->findVideo("Eminem", "Sing for the moment"); //returns an youtube link based on the given artist & title
Update 29-10-2014
- Youtube API Tracks added