This is a PHP wrapper for the Apple Music API.
- PHP 7.1 or later.
- HTTP Client
This wrapper relies on HTTPlug, which defines how HTTP message should be sent and received. You can use any library to send HTTP messages that implements php-http/client-implementation.
Here is a list of all officially supported clients and adapters by HTTPlug: http://docs.php-http.org/en/latest/clients.html
Read more about HTTPlug in their docs.
Install it using Composer:
composer require pouler/apple-music-apiTo install with Guzzle 6 you may run the following command:
$ composer require pouler/apple-music-api php-http/guzzle6-adapter php-http/message
Before using the Apple Music API, you need to sign up for the Apple Developer Programm. Read more about this here.
<?php
require 'vendor/autoload.php';
$jwtToken = PouleR\AppleMusicAPI\AppleMusicAPITokenGenerator::generateDeveloperToken(
'team.id',
'key.id',
'/path/to/authkey.p8'
);
$client = new PouleR\AppleMusicAPI\APIClient();
$client->setDeveloperToken($jwtToken);
$api = new PouleR\AppleMusicAPI\AppleMusicAPI($client);
$result = $api->getCatalogPlaylist('nl', 'pl.a56541661a7a4cca95ddeca24e5e5316');
print_r($result);