detain / phlix-plugin-lastfm
Last.fm scrobbler plugin for Phlix — scrobbles music playback to Last.fm.
Package info
github.com/detain/phlix-plugin-lastfm
Type:phlix-plugin
pkg:composer/detain/phlix-plugin-lastfm
Requires
- php: >=8.3
- detain/phlix-shared: ^0.18.0
- psr/container: ^1.1 || ^2.0
- psr/log: ^1.0 || ^2.0 || ^3.0
- workerman/mysql: ^1.0
Requires (Dev)
- phpstan/phpstan: ^2.2
- phpstan/phpstan-phpunit: ^2.0
- phpunit/phpunit: ^10.0
- react/promise: ^3.3
- workerman/http-client: ^3.1
Suggests
- workerman/http-client: Async HTTP client for Workerman — use with LastfmPlugin to avoid blocking file_get_contents on scrobble/now-playing calls.
This package is auto-updated.
Last update: 2026-07-11 00:46:51 UTC
README
Last.fm scrobbler plugin for Phlix — scrobbles your music playback to Last.fm.
Overview
Connects a Phlix server to your Last.fm account:
- Now Playing — on playback start the plugin calls Last.fm
track.updateNowPlayingso your profile shows what you're listening to in real time. - Scrobbling — on playback stop the plugin submits a
track.scrobble, enforcing Last.fm's official rule (track longer than 30 seconds and more than 50% played) before anything is recorded. - Authenticates via Last.fm web auth, signing every call with your shared secret and storing one session key per Phlix user.
It subscribes to phlix.playback.started and phlix.playback.stopped.
Install
From the Phlix admin Plugins section, paste this repo's URL:
https://github.com/detain/phlix-plugin-lastfm
…or from the CLI:
php bin/phlix plugin:install https://github.com/detain/phlix-plugin-lastfm
Settings
Configure these in the Phlix admin Plugins → Configure dialog.
| Setting | Type | Required | Default | Description |
|---|---|---|---|---|
enabled |
bool | no | false |
Master on/off for Last.fm scrobbling. |
api_key |
string | yes | — | Your Last.fm API key. Create a free API account at last.fm/api/account/create. |
shared_secret |
string (secret) | yes | — | The "Shared secret" shown next to your API key on your Last.fm API accounts page. Used to sign authenticated requests. |
callback_url |
string | no | server URL | The Callback URL you registered for your Last.fm API application (OAuth handshake). |
username |
string | no | — | Display-only: the Last.fm account scrobbles are sent to (set during authorization). |
Where to get your credentials
- Sign in to Last.fm and open Create an API account.
- Fill in the application name/description; the Callback URL should point back at your Phlix server.
- Copy the API key into
api_keyand the Shared secret intoshared_secret. - Enable the plugin and toggle
enabledon.
Development
composer install vendor/bin/phpunit
The entry class is Phlix\Plugins\Scrobbler\Lastfm\LastfmPlugin (implements
Phlix\Shared\Plugin\LifecycleInterface). It runs inside a Phlix server host,
which provides the playback/library services at runtime.
License
MIT — see LICENSE.