music-companion/apple-music 问题修复 & 功能扩展

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

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

music-companion/apple-music

Composer 安装命令:

composer require music-companion/apple-music

包简介

Apple Music SDK

README 文档

README

Build Status codecov Type Coverage

This is a sdk to consume part of the Apple Music API.

Installation

composer require music-companion/apple-music

Usage

use MusicCompanion\AppleMusic\{
    SDK,
    Key,
};
use Innmind\OperatingSystem\Factory;
use Innmind\TimeContinuum\Earth\Period\Hour;
use Innmind\Url\Path;
use Innmind\Filesystem\Name;
use Innmind\Immutable\Set;

$os = Factory::build();

$sdk = SDK::of(
    $os->clock(),
    $os->remote()->http(),
    Key::of( // @see https://help.apple.com/developer-account/#/devce5522674 to understand howto generate the key
        'KEY_ID',
        'TEAM_ID',
        $os
            ->filesystem()
            ->mount(Path::of('config_dir/'))
            ->get(new Name('AuthKey_TEAM_ID.p8'))
            ->match(
                static fn($file) => $file->content(),
                static fn() => throw new \RuntimeException('Key file not found'),
            ),
    ),
    new Hour(1) // expire the generated token after an hour
);

$sdk->storefronts()->all(); // Set<SDK\Storefront>
$catalog = $sdk->catalog(new SDK\Storefront\Id('fr'));
$result = $catalog->search('Pendulum Live at Brixton');
$albums = $result->albums()->map($catalog->album(...));

// @see https://developer.apple.com/documentation/applemusicapi/getting_keys_and_creating_tokens
// to retrieve the user token
$sdk->library($userToken)->match(
    static fn($libray) => $libray->artists(), // Set<SDK\Library\Artist>
    static fn() => throw new \RuntimeException('Invalid user token'),
);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固