PHPackages                             chrismou/lastfm - 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. [API Development](/categories/api)
4. /
5. chrismou/lastfm

ActiveLibrary[API Development](/categories/api)

chrismou/lastfm
===============

A simple but fully featured Last.fm API wrapper, with Guzzle 6 support

21.2k[1 issues](https://github.com/chrismou/php-lastfm-wrapper/issues)PHP

Since Mar 24Pushed 10y ago1 watchersCompare

[ Source](https://github.com/chrismou/php-lastfm-wrapper)[ Packagist](https://packagist.org/packages/chrismou/lastfm)[ RSS](/packages/chrismou-lastfm/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Last.fm API Wrapper
=======================

[](#php-lastfm-api-wrapper)

[![Build Status](https://camo.githubusercontent.com/61eb2f27db21030c4646047e29f6f108c94301a96f7683b6b75be798dd8684b8/68747470733a2f2f7472617669732d63692e6f72672f63687269736d6f752f7068702d6c617374666d2d777261707065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/chrismou/php-lastfm-wrapper)[![Test Coverage](https://camo.githubusercontent.com/faf45e5a5a765aa4f3d2d80f0ebd07022afa90448b81289309ad5a8da3956763/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f63687269736d6f752f7068702d6c617374666d2d777261707065722f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/chrismou/php-lastfm-wrapper/coverage)[![Code Climate](https://camo.githubusercontent.com/ce0883604ae6773ab8288c9aa3b911dc54f114cec52616a7678388a166b170d9/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f63687269736d6f752f7068702d6c617374666d2d777261707065722f6261646765732f6770612e737667)](https://codeclimate.com/github/chrismou/php-lastfm-wrapper)[![Buy me a beer](https://camo.githubusercontent.com/84435278ebf644da9ba4ece64a76602c16bb88edd474ee54cc757a17eca9666f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d50617950616c2d3031394344452e737667)](https://www.paypal.me/chrismou)

A dead simple wrapper class for the last.fm API. After using a couple of existing last.fm wrapper classes, it became obvious that most were either a) Incomplete, b) Seemingly abandoned, or c) Poorly unit tested. After the August 2015 last.fm redesign, the library I'd settled with started throwing unexepected errors. At this point, I decided it might be simpler to just write my own.

This library aims to address these issues, providing a simple, centralised way of calling any method on the last.fm API, meaning it should support all future API additions out of the box. It also includes an full set of unit tests.

Install
-------

[](#install)

For [composer](http://getcomposer.org) based projects:

```
composer require chrismou/lastfm

```

Usage
-----

[](#usage)

First you need an API key and secret from Last.FM. You can obtain one by signing up here:

To set up the last.fm API client:

```
$lastfm = new \Chrismou\LastFm\LastFm(
    new GuzzleHttp\Client(),
    YOUR_API_KEY,
    YOUR_API_SECRET
);

```

The format for calls is: `$lastfm->get($method, $parameters);`, where method is the last.fm api method name.

So, if you wanted to get info on an artist, you could run:

```
$lastfm->get('artist.getInfo', 'cher');

```

This makes a request and returns all info on the Artist 'Cher'.

Please refer to the [last.fm api documentation](http://www.last.fm/api) for a full list of available methods and required parameters.

Tests
-----

[](#tests)

To run the unit test suite:

```
curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit

```

If you use docker, you can also run the test suite against all supported PHP versions:

```
./vendor/bin/dunit

```

License
-------

[](#license)

Released under the MIT License. See [LICENSE](LICENSE.md).

Thanks to
---------

[](#thanks-to)

[dandelionmood/php-lastfm](https://github.com/dandelionmood/php-lastfm), the original inspiration for the library.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/319883?v=4)[Chris Chrisostomou](/maintainers/chrismou)[@chrismou](https://github.com/chrismou)

---

Top Contributors

[![chrismou](https://avatars.githubusercontent.com/u/319883?v=4)](https://github.com/chrismou "chrismou (21 commits)")

### Embed Badge

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

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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