dolejska-daniel / riot-api

Riot League of Legends & DataDragon API wrappers for PHP7 and PHP8.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue on DataDragonAPI::getProfileIcon($id)

New-on-Git opened this issue · comments

After initializing :
use RiotAPI\DataDragonAPI\DataDragonAPI;
DataDragonAPI::initByCdn();
require DIR . "/vendor/autoload.php";
in one of my own page i have problem with DataDragonAPI::getProfileIcon($id).

it won't work no matter what and i'm stuck here :(

Error message : Warning: require_once(Nette\Localization\Nette\Localization\ITranslator.php): failed to open stream: No such file or directory in C:\wamp64\www\kyt-site\inc\autoload.php on line 9

I also can't find the ITranslator file.

`$id = 61;

if(isset($result[1])){
$id2 = $result[1];
}else{
$id2 = "New on League";
}

try
{$summoner = $api->getSummonerByName($id2);}
catch (Exception $ex)
{die("Request failed to be processed: " . $ex->getMessage());}

//$summoner = $api->getSummonerByName("New on League");
$masteries = $api->getChampionMastery($summoner->id, $id);

$idProfileIcon = $summoner->profileIconId;
var_dump($idProfileIcon);
//$icone = $api->getStaticProfileIcons($idProfileIcon);
// $icone = DataDragonAPI::getProfileIcon($idProfileIcon);
$icone = DataDragonAPI::getProfileIcon($idProfileIcon, [ 'class' => 'img-thumbnail', ]);
// die();
?>`

Here is a screenshot of the bug :
image

Did i missed something or failed to initialized somthing ?

Hello, this is probably not your mistake. Could you tell me which version of the library are you using?

i have version v4.1.3 i think

on composer.lock :
"name": "dolejska-daniel/riot-api",
"version": "v4.1.3",

Could you try pulling the v5.0.0-alpha even though it is pre-release? That could help.

Hello,
the only installation link working for me is : composer require dolejska-daniel/riot-api wich install the version 4.1.3

both followinw link don't work for me :
-composer require "dolejska-daniel/riot-api[v5.0.0-alpha]"
-composer require "dolejska-daniel/riot-api:^5"
i also tested both with and without the quotation marks

Did you also set minimum-stability to at least alpha or dev?

Yes and it's still not working

Just tried and it is working. There may be other dependencies which are preventing you from updating to the latest version of the library. The library requires at least PHP7.3. Please provide the error from the composer upon installation fail.

{
    "name": "thekronny/test",
    "require": {
        "dolejska-daniel/riot-api": "v5.0.0-alpha"
    },
    "authors": [
        {
            "name": "Daniel Dolejška",
            "email": "xxx@yyy.zzz"
        }
    ]
}
No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 26 installs, 0 updates, 0 removals
  - Locking dolejska-daniel/riot-api (v5.0.0-alpha)
  - Locking dolejska-daniel/riot-api-base (v1.0.2)
  - Locking dolejska-daniel/riot-api-datadragon (v1.0.0)
  - Locking dolejska-daniel/riot-api-league (v1.0.0)
  - Locking guzzlehttp/guzzle (7.2.0)
  - Locking guzzlehttp/promises (1.4.1)
  - Locking guzzlehttp/psr7 (1.7.0)
  - Locking nette/utils (v3.2.2)
...
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 26 installs, 0 updates, 0 removals
...
  - Installing nette/utils (v3.2.2): Extracting archive
  - Installing dolejska-daniel/riot-api-datadragon (v1.0.0): Extracting archive
  - Installing dolejska-daniel/riot-api (v5.0.0-alpha): Extracting archive
11 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files

I just checked and i'm on PHP 7.4.9

image

after that i only have a composer.json in my files but it's only contain : {}

Try this instead:

composer require dolejska-daniel/riot-api:v5.0.0-alpha

This one worked fine ! Thanks
I will check if the Datadragon API works this time :)

So i changed the version but i'm stuck with the same bug.
i figured out that something was wrong in the nette directory and i found some issues on compatibility.php
image

here is the most part of the code :

`if (false) {
/** @deprecated use Nette\HtmlStringable */
interface IHtmlString extends Nette\HtmlStringable
{
}
} elseif (!interface_exists(IHtmlString::class)) {
class_alias(Nette\HtmlStringable::class, IHtmlString::class);
}

namespace Nette\Localization;

if (false) {
/** @deprecated use Nette\Localization\Translator */
interface ITranslator extends Translator
{
}
} elseif (!interface_exists(ITranslator::class)) {
class_alias(Translator::class, ITranslator::class);
}`

Do you have the same issue on your own ? Or it's missing only for me ?

The package I'm using for HTML generation is probably being deprecated or something. I'm really sorry for the inconvenience. I'll try fixing the bug, but that will most probably happen tomorrow. I'll let you know.

Thank you for letting me know this 👍🏽

i figured out this morning that exemples from riot-api-datadragon worked, once the _init.php path is fixed. And i can recreate the same working file only in the vendor folder
The issue is not necessarily due to your files being deprecated. I have high suspicions it's due to another autoload in my files wich create a conflict.

Does this mean that the issue has been solved? 😄

Not yet, i'll be working on it on the week-end :)
I'll close the issue asap !

I am planning on removing the nette/utils dependency later anyway.

I found a way to fix my issue.
I had to add my own autoload in composer.json then do a new composer install in composer.

Thanks for helping !