PHPackages                             spatie/last-fm-now-playing - 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. spatie/last-fm-now-playing

ActiveLibrary[API Development](/categories/api)

spatie/last-fm-now-playing
==========================

Get track info that a user is currently playing

1.1.2(5y ago)4613.2k↓50%102MITPHPPHP ^5.5|^7.0|^8.0

Since May 7Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/spatie/last-fm-now-playing)[ Packagist](https://packagist.org/packages/spatie/last-fm-now-playing)[ Docs](https://github.com/spatie/last-fm-now-playing)[ RSS](/packages/spatie-last-fm-now-playing/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (2)

Get the currently playing track from a last.fm user
===================================================

[](#get-the-currently-playing-track-from-a-lastfm-user)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0a3e701811036db609d283ef3703960d3f7f8a366a028ee70edc6bc6667d268f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c6173742d666d2d6e6f772d706c6179696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/last-fm-now-playing)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/9d272144c27f451540de5e2132b6baf0caf6a3bfda1aad858c8b4c150c73af45/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f6c6173742d666d2d6e6f772d706c6179696e672f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spatie/last-fm-now-playing)[![Quality Score](https://camo.githubusercontent.com/fb69b1fdf6ea5e7ae1c146506e0307427f8c1d51a802a201055b408021e1f9c4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370617469652f6c6173742d666d2d6e6f772d706c6179696e672e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spatie/last-fm-now-playing)[![Total Downloads](https://camo.githubusercontent.com/8d88073830b0a5691e0fa7b344a2c45bd943ab9fd7b32a4d03706e0f151487fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c6173742d666d2d6e6f772d706c6179696e672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/last-fm-now-playing)

This package contains a class to determine the current track a specified user is playing according to last.fm

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/7b57ad28bb2ff8cdf66f1e971f3e58b4a64d13132c8152af3bf5d43776f1be5c/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c6173742d666d2d6e6f772d706c6179696e672e6a70673f743d31)](https://spatie.be/github-ad-click/last-fm-now-playing)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/last-fm-now-playing
```

Usage
-----

[](#usage)

The constructor of `Spatie\NowPlaying\NowPlaying` needs an api key you can get [from the last.fm site](http://www.last.fm/api/account/create).

```
$nowPlaying = new Spatie\NowPlaying\NowPlaying($apiKey);

$nowPlaying->getTrackInfo($lastFmUserName);
```

If the specified user is currently playing a track you'll get backy and array with keys `artist`, `album`, `trackName`, `artwork` and `trackUrl`. The `getTrackInfo`-function will return `false` when a user is not currently playing a track.

If something goes wrong an instance of `Spatie\NowPlaying\Exceptions\BadResponse` will be thrown.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Postcardware
------------

[](#postcardware)

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards [on our company website](https://spatie.be/en/opensource/postcards).

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance54

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

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

Every ~280 days

Recently: every ~417 days

Total

7

Last Release

1978d ago

Major Versions

0.0.1 → 1.0.02016-05-09

PHP version history (2 changes)0.0.1PHP ^5.5|^7.0

1.1.2PHP ^5.5|^7.0|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (28 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (6 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (2 commits)")[![etiennemarais](https://avatars.githubusercontent.com/u/4479918?v=4)](https://github.com/etiennemarais "etiennemarais (1 commits)")[![akoepcke](https://avatars.githubusercontent.com/u/5311185?v=4)](https://github.com/akoepcke "akoepcke (1 commits)")[![m0ter](https://avatars.githubusercontent.com/u/20525306?v=4)](https://github.com/m0ter "m0ter (1 commits)")[![Tjoosten](https://avatars.githubusercontent.com/u/5157609?v=4)](https://github.com/Tjoosten "Tjoosten (1 commits)")

---

Tags

lastfmmusicphpspatielast-fm-now-playing

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spatie-last-fm-now-playing/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-last-fm-now-playing/health.svg)](https://phpackages.com/packages/spatie-last-fm-now-playing)
```

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[spatie/laravel-fractal

An easy to use Fractal integration for Laravel applications

1.9k15.1M99](/packages/spatie-laravel-fractal)[spatie/fractalistic

A developer friendly wrapper around Fractal

38715.3M8](/packages/spatie-fractalistic)[spatie/laravel-json-api-paginate

A paginator that plays nice with the JSON API spec

6314.7M46](/packages/spatie-laravel-json-api-paginate)[spatie/laravel-route-attributes

Auto register routes using PHP attributes

879963.2k18](/packages/spatie-laravel-route-attributes)[spatie/dropbox-api

A minimal implementation of Dropbox API v2

3116.0M36](/packages/spatie-dropbox-api)

PHPackages © 2026

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