PouleR / apple-music-api

PHP Wrapper for the Apple Music API
39 stars 13 forks source link

Deprecated: Non-static method and atal error: Uncaught Http\Discovery\Exception\DiscoveryFailedException: Could not find resource using any discovery strategy. #4

Closed RomainDev25 closed 5 years ago

RomainDev25 commented 5 years ago

Hello, for a simple test I have this error :

Deprecated: Non-static method PouleR\AppleMusicAPI\AppleMusicAPITokenGenerator::generateDeveloperToken() should not be called statically in C:\wamp64\www\getid3\AppleMusic\find.php on line 5

And this

Fatal error: Uncaught Http\Discovery\Exception\DiscoveryFailedException: Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors - Puli Factory is not available - No valid candidate found using strategy "Http\Discovery\Strategy\CommonClassesStrategy". We tested the following candidates: Nyholm\Psr7\Factory\HttplugFactory, Http\Message\MessageFactory\GuzzleMessageFactory, Http\Message\MessageFactory\DiactorosMessageFactory, Http\Message\MessageFactory\SlimMessageFactory. - No valid candidate found using strategy "Http\Discovery\Strategy\CommonPsr17ClassesStrategy". We tested the following candidates: . in C:\wamp64\www\getid3\AppleMusic\vendor\php-http\discovery\src\ClassDiscovery.php on line 210

<?php

require 'vendor/autoload.php';

$jwtToken = PouleR\AppleMusicAPI\AppleMusicAPITokenGenerator::generateDeveloperToken(
    '{MY-team.id}',
    '{MY-key.id}',
    dirname(dirname(__FILE__)) . '/AuthKey/key.p8'
);

$client = new PouleR\AppleMusicAPI\APIClient();
$client->setDeveloperToken($jwtToken);

$api = new PouleR\AppleMusicAPI\AppleMusicAPI($client);

$result = $api->getCatalogPlaylist('nl', 'pl.a56541661a7a4cca95ddeca24e5e5316');

print_r($result);

?>

Thanks

RomainDev25 commented 5 years ago

Ok, I fix the first warning with

static function generateDeveloperToken($teamId, $keyId, $keyFile, $expirationDays = self::MAX_EXP_DAYS)

But for the second, i try this command : composer require puli/composer-plugin

  [InvalidArgumentException]
  Could not find a version of package puli/composer-plugin matching your minimum-stability (stable). Require it with an explici
  t version constraint allowing its desired stability.

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [-
-update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-p
ackages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
PouleR commented 5 years ago

Hi there,

Since release v0.2.0 the static method was removed, see also https://github.com/PouleR/apple-music-api/releases/tag/v0.2.0.

I just updated the readme, I saw I forgot to update that.