Skip to content

Hemant-Mann/LastFm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP last.fm API

Basic Usage

<?php
require "autoloader.php";
use LastFm\Src\Caller\CallerFactory as CallerFactory;
use LastFm\Src\Artist as Artist;

// set api key
CallerFactory::getDefaultCaller()->setApiKey('<Your API key>');

// search for the Coldplay band
$artistName = "Linkin Park";

$tracks = Artist::getTopTracks($artistName);

$results = [];
foreach ($tracks as $key => $track) {
	$results[] = [
		'name' => $track->getName(),
		'played' => $track->getPlayCount(),
		'url' => $track->getUrl()
	];
}

echo json_encode($results);

?>

About

Last.fm API Library in PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages