pouler / apple-music-api
PHP Wrapper for the Apple Music API
Installs: 84 895
Dependents: 0
Suggesters: 0
Security: 0
Stars: 39
Watchers: 4
Forks: 13
Open Issues: 1
Requires
- php: >=8.1
- ext-json: *
- symfony/http-client: ^6|^7
- web-token/jwt-library: ^3.0|^4.0
Requires (Dev)
- phpunit/phpunit: ^10
- squizlabs/php_codesniffer: ^3.0
README
Apple Music API PHP
This is a PHP wrapper for the Apple Music API.
Requirements
- PHP 8.1 or later.
- Symfony HTTP Client
Installation
Install it using Composer:
composer require pouler/apple-music-api
Usage
Before using the Apple Music API, you need to sign up for the Apple Developer Program. Read more about this here.
<?php require 'vendor/autoload.php'; $tokenGenerator = new PouleR\AppleMusicAPI\AppleMusicAPITokenGenerator(); $jwtToken = $tokenGenerator->generateDeveloperToken( 'team.id', 'key.id', '/path/to/authkey.p8' ); $curl = new \Symfony\Component\HttpClient\CurlHttpClient(); $client = new PouleR\AppleMusicAPI\APIClient($curl); $client->setDeveloperToken($jwtToken); $api = new PouleR\AppleMusicAPI\AppleMusicAPI($client); $result = $api->getCatalogPlaylist('nl', 'pl.a56541661a7a4cca95ddeca24e5e5316'); print_r($result);