matto1990/lastfm-api

Last.fm webservice client

Maintainers

👁 devilcius

Package info

github.com/matto1990/PHP-Last.fm-API

Issues

pkg:composer/matto1990/lastfm-api

Statistics

Installs: 16 058

Dependents: 1

Suggesters: 0

Stars: 107

v1.6.4 2019-06-14 07:38 UTC

Requires

  • php: >=5.3.3

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 6a3125d53f5debf44dd32e41f8da49177483424b

  • Marcos <devilcius.woop@gmail.com>
  • Matt <matt.woop@oakes.ws>

apilast.fmwebservice client

This package is not auto-updated.

Last update: 2026-06-20 16:36:33 UTC


README

Thank you for using PHP Last.FM API!

You will need your own API key by registering at: http://www.last.fm/api

Installation

composer require matto1990/lastfm-api

Usage

use LastFmApi\Api\AuthApi;
use LastFmApi\Api\ArtistApi;

class LastFm
{
 private $apiKey;
 private $artistApi;

 public function __construct()
 {
 $this->apiKey = 'apikeyfromlastfm'; //required
 $auth = new AuthApi('setsession', array('apiKey' => $this->apiKey));
 $this->artistApi = new ArtistApi($auth);
 }
 public function getBio($artist)
 {
 $artistInfo = $this->artistApi->getInfo(array("artist" => $artist));

 return $artistInfo['bio'];
 }	
}

Testing

To run phpunit successfully, a .env file must be included in tests/Api:

lastfm_api_key=
lastfm_api_secret=
lastfm_token=
lastfm_session_key=
lastfm_username=

If you just want to run the tests that don't need authentication: vendor/bin/phpunit --group notAuthenticated. In this case you'll only need to set lastfm_api_key property.