thatobabusi/laravel-lastfm 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thatobabusi/laravel-lastfm

Composer 安装命令:

composer require thatobabusi/laravel-lastfm

包简介

Last.fm API client for Laravel 7-13

README 文档

README

Last.fm API Client for Laravel Typing intro



Repo stars Repo forks Repo watchers

Latest release Last commit Open issues Open pull requests License Contributors


Packagist Downloads MIT License


📦 Packagist · 📚 Docs · 📜 Changelog · 🔗 Last.fm API

A modern, type-safe Last.fm API client for Laravel 7-13. Built with fluent interfaces, full type hints, and dependency injection support.

Documentation

Features

API Integration

  • Fluent interface for all major Last.fm API endpoints
  • User statistics and track information retrieval
  • Weekly and overall chart data
  • Now-playing track detection

Laravel Integration

  • Auto-registration via package discovery (Laravel 5.5+)
  • Dependency injection support
  • Configuration publishing
  • Service provider binding

Developer Experience

  • Full type hints and strict mode
  • Chainable query builder pattern
  • Per-request period and limit filtering
  • Tested against Laravel 7, 8, 9, 10, 11, 12, and 13

Requirements

  • PHP >= 7.4
  • Laravel >= 7.0
  • Guzzle HTTP Client 6 or 7

Installation

Install via Composer:

composer require thatobabusi/laravel-lastfm

Configuration

Add your Last.fm API key to your .env file:

LASTFM_API_KEY=your_api_key_here

Or publish and customize the configuration file:

php artisan vendor:publish --provider="Thatobabusi\LaravelLastFm\LastfmServiceProvider"

For Laravel versions prior to 5.5, manually register the service provider in config/app.php:

'providers' => [
    ...
    Thatobabusi\LaravelLastFm\LastfmServiceProvider::class,
];

Usage

Basic Example

Inject the Lastfm class into your controller or service:

use Thatobabusi\LaravelLastFm\Lastfm;

public function topAlbums(Lastfm $lastfm)
{
    $albums = $lastfm->userTopAlbums('username')->get();
    return view('albums', compact('albums'));
}

Available Methods

User Statistics

  • userTopAlbums(string $username) — Get user's top albums
  • userTopArtists(string $username) — Get user's top artists
  • userTopTracks(string $username) — Get user's top tracks
  • userInfo(string $username) — Get user profile information
  • userRecentTracks(string $username) — Get user's recent tracks

Real-time Data

  • nowListening(string $username) — Get currently playing track (or false)

Weekly Charts

  • userWeeklyTopAlbums(string $username, DateTime $startdate) — Get weekly top albums
  • userWeeklyTopArtists(string $username, DateTime $startdate) — Get weekly top artists
  • userWeeklyTopTracks(string $username, DateTime $startdate) — Get weekly top tracks
  • userWeeklyChartList(string $username) — Get list of available weekly charts

Filtering Results

Chain methods to customize your queries:

use Thatobabusi\LaravelLastFm\Constants;

// Filter by time period
$lastfm->userTopAlbums('username')
    ->period(Constants::PERIOD_MONTH)
    ->get();

// Limit results
$lastfm->userTopAlbums('username')
    ->limit(5)
    ->get();

// Paginate through results
$lastfm->userTopAlbums('username')
    ->limit(10)
    ->page(2)
    ->get();

Time Periods

Use these constants with the ->period() method:

Constants::PERIOD_WEEK       // Last 7 days
Constants::PERIOD_MONTH      // Last month
Constants::PERIOD_3_MONTHS   // Last 3 months
Constants::PERIOD_6_MONTHS   // Last 6 months
Constants::PERIOD_YEAR       // Last 12 months
Constants::PERIOD_OVERALL    // All time

Getting an API Key

Create a Last.fm account and generate an API key at: http://www.last.fm/api/account/create

API Documentation

For complete Last.fm API reference, see: http://www.last.fm/api

Testing

Copy phpunit.xml.dist to phpunit.xml and configure your Last.fm API key, then run:

composer test

🤝 Contributing

Issues and pull requests are welcome for bug fixes, features, and documentation.
Please see CONTRIBUTING.md and CODE OF CONDUCT for details.

🔒 Security

If you discover a security vulnerability, please email thatobabusi@yahoo.com instead of using the issue tracker.

📜 License

Open-sourced software licensed under the MIT license.
Built with ❤️ for the Laravel community.

Footer wave

thatobabusi/laravel-lastfm 适用场景与选型建议

thatobabusi/laravel-lastfm 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「client」 「service provider」 「laravel」 「lastfm」 「last.fm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 thatobabusi/laravel-lastfm 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 thatobabusi/laravel-lastfm 我们能提供哪些服务?
定制开发 / 二次开发

基于 thatobabusi/laravel-lastfm 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 23
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-06