PHPackages                             marvelley/lastfm-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. marvelley/lastfm-api

ActiveLibrary[HTTP &amp; Networking](/categories/http)

marvelley/lastfm-api
====================

A last.fm API client

v0.1(12y ago)61563[1 issues](https://github.com/craigmarvelley/last-fm-api-client/issues)[1 PRs](https://github.com/craigmarvelley/last-fm-api-client/pulls)1MITPHPPHP &gt;=5.3.2

Since Sep 23Pushed 12y agoCompare

[ Source](https://github.com/craigmarvelley/last-fm-api-client)[ Packagist](https://packagist.org/packages/marvelley/lastfm-api)[ RSS](/packages/marvelley-lastfm-api/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (1)

Last.fm API client
==================

[](#lastfm-api-client)

This is a client for the last.fm API. It uses the [Guzzle](http://guzzlephp.org/) web service library. The client API is a custom web service client based on `Guzzle\Service\Client`.

[![Build Status](https://camo.githubusercontent.com/ed98098082c649e3dbb15a73e70d66c7123b52af7de042c3ceaac13657978286/68747470733a2f2f7472617669732d63692e6f72672f63726169676d617276656c6c65792f6c6173742d666d2d6170692d636c69656e742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/craigmarvelley/last-fm-api-client)

Installation
------------

[](#installation)

Use composer to install the library and all its dependencies:

```
composer require "marvelley/lastfm-api:1.0.*@dev"

```

Basic Usage Example
-------------------

[](#basic-usage-example)

Before you can use the library you have to request your API key on the [last.fm API page](http://last.fm/api).
Put that key in the following code and run the code from the command line:

```
require 'vendor/autoload.php';

use Marvelley\Lastfm\Api\LastfmApiClient;

$l = LastfmApiClient::factory(array('api_key' => 'your_api_key'));
$ai = $l->getCommand('artist.getInfo', array(
	'artist' => 'Elvis Presley',
	"format" => "json"
));
$result = $ai->execute();
echo "Similar artists:\n";
foreach($result['artist']['similar']['artist'] as $artist) {
	printf("  - %s\n", $artist['name']);
}
```

\## Running integration tests

Before running the test suite you need to configure a specific environment variable with a valid last.fm API key. For example, from your terminal:

```
$ export LAST_FM_PHP_CLIENT_API_KEY=your_api_key

```

or add a similar entry to your bash/zsh/whatever config file.

You can then run the test suite via:

```
$ phpunit

```

from the root of the project directory (assuming you have PHPUnit installed and on the path).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4552d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7ce2e40266b6908a15c30f77cbbc5301e560b1ec28c77389768e4c313d7f0f39?d=identicon)[craigmarvelley](/maintainers/craigmarvelley)

---

Top Contributors

[![craigmarvelley](https://avatars.githubusercontent.com/u/265907?v=4)](https://github.com/craigmarvelley "craigmarvelley (13 commits)")[![gbirke](https://avatars.githubusercontent.com/u/223326?v=4)](https://github.com/gbirke "gbirke (3 commits)")[![electblake](https://avatars.githubusercontent.com/u/22871?v=4)](https://github.com/electblake "electblake (1 commits)")

---

Tags

Guzzle

### Embed Badge

![Health badge](/badges/marvelley-lastfm-api/health.svg)

```
[![Health](https://phpackages.com/badges/marvelley-lastfm-api/health.svg)](https://phpackages.com/packages/marvelley-lastfm-api)
```

###  Alternatives

[bradfeehan/desk-php

PHP client for Desk.com v2 API based on Guzzle

2181.4k](/packages/bradfeehan-desk-php)[cossou/trak-io-api-client

PHP Trak.io Api Client built on Guzzle

204.0k](/packages/cossou-trak-io-api-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
