luizpedone/lastfm

last.fm API的包装器。

dev-master 2018-03-04 15:10 UTC

This package is not auto-updated.

Last update: 2024-09-20 09:21:37 UTC


README

Maintainability Test Coverage CircleCI

此包将last.fm API包装在一个易于使用的PHP包中。目前此包正在开发中。

安装

要使用composer安装,请执行以下命令

composer require luizpedone/lastfm

如何使用它

<?php

$lastFm = new \LuizPedone\LastFM\LastFM('your-last-fm-api-key');

$topArtists = $lastFm->user()
    ->topArtists('luiz-pedone')
    ->period(Period::LAST_MONTH)
    ->limit(10)
    ->get();

// Outputs an array of \LuizPedone\LastFM\User\Entity\TopArtist objects
foreach ($topArtists as $topArtist) {
    echo $topArtist->getName();
    echo $topArtist->getPlayCount();
}