PHPackages                             j3j5/lastfm-apio - 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. j3j5/lastfm-apio

ActiveLibrary[API Development](/categories/api)

j3j5/lastfm-apio
================

A simple PHP wrapper for the Last.fm API that allows you to launch parallel requests.

014PHP

Since Dec 27Pushed 10y ago1 watchersCompare

[ Source](https://github.com/j3j5/lastfm-apio)[ Packagist](https://packagist.org/packages/j3j5/lastfm-apio)[ RSS](/packages/j3j5-lastfm-apio/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/fb0d453d64085462e318a967906da9bb43d13e7f8ba4846f29fddf342154396a/68747470733a2f2f7472617669732d63692e6f72672f6a336a352f6c617374666d2d6170696f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/j3j5/lastfm-apio)

LastfmApio
==========

[](#lastfmapio)

LastfmApio is a simple PHP wrapper for the Last.fm API that allows you to make parallel requests so it works faster (JS style).

Internally, it uses [marcushat/RollingCurlX](https://github.com/marcushat/RollingCurlX), a wrapper of cURL Multi.

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

[](#installation)

Add `j3j5/lastfm-apio` to `composer.json`.

```
"j3j5/lastfm-apio": "dev-master"

```

Run `composer update` to pull down the latest version of LastfmApio.

or alternatively, run

```
$ composer require j3j5/lastfm-apio dev-master

```

Configuration
-------------

[](#configuration)

Open up the `config.php` included with the package and set there all your API key and secret (optional).

Alternatively, you can set your own config array and use it to overwrite the config file when you create the first instance of LastfmApio. The array config must be as follows:

```
$lastfm_settings = array(
	'api_key'		=> 'YOUR_API_KEY',
	'api_secret'	=> 'YOUR_API_SECRET',
);

$api = new LastfmApio($lastfm_settings);
```

Use
---

[](#use)

Once you have created your own instance of the library, you can use any of the public methods to request from Twitter's API.

If you decide to set your tokens from your own app instead of from the config file:

```
use j3j5\LastfmApio;

$lastfm_settings = array(
	'api_key'		=> 'YOUR_API_KEY',
	'api_secret'	=> 'YOUR_API_SECRET',
);

$api = new LastfmApio($lastfm_settings);

// Now you can do all type of requests

$user_info = $api->user_getinfo(
	array('user' => $username)
);
$artist = $api->artist_getInfo(
	array('artist' => 'Rosendo')
);
```

Or the more interesting ones...the ones with concurrent requests!!

```
use j3j5\LastfmApio;

$lastfm_settings = array(
	'api_key'		=> 'YOUR_API_KEY',
	'api_secret'	=> 'YOUR_API_SECRET',
);

$api = new LastfmApio($lastfm_settings);

$username = 'lapegatina';
$api->user_getweeklyartistchart(array('user' => $username), FALSE, TRUE);
$api->user_getweeklyartistchart(array('user' => $username, 'from' => 1210507200, 'to' => 1211112000), FALSE, TRUE);
$api->user_getweeklyartistchart(array('user' => $username, 'from' => 1217764800, 'to' => 1218369600), FALSE, TRUE);
$api->user_getweeklyartistchart(array('user' => $username, 'from' => 1232280000, 'to' => 1232884800), FALSE, TRUE);

// The response to all concurrent requests is return as an array using as key a string of the parameters joined by '.'
$responses = $api->run_multi_requests();
foreach($responses AS $response) {
	$allresponseresults = isset($response->weeklyartistchart->artist) ? $response->weeklyartistchart->artist : array();
	print count($allresponseresults) . " artists found." . PHP_EOL;
}
```

You can also change the maximum amount of concurrent requests to be launched against the API doing

```
$api->set_max_concurrent_reqs(50); // High values might get you in trouble with Last.fm, please be considerate with them!
```

This library is deeply inspired on [dandelionmood/php-lastfm](https://github.com/dandelionmood/php-lastfm), which was useful but did not support multirequests, which made me code this one.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

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://www.gravatar.com/avatar/87fcc720208de023144a17f3e72cccf8fb872d652b8f1ab0724c765e44e3d717?d=identicon)[j3j5](/maintainers/j3j5)

---

Top Contributors

[![j3j5](https://avatars.githubusercontent.com/u/1239921?v=4)](https://github.com/j3j5 "j3j5 (23 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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