dolejska-daniel / riot-api

Riot League of Legends & DataDragon API wrappers for PHP7 and PHP8.
GNU General Public License v3.0
112 stars 25 forks source link

Issue on DataDragonAPI::getProfileIcon($id) #101

Closed New-on-Git closed 3 years ago

New-on-Git commented 3 years ago

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 ?

dolejska-daniel commented 3 years ago

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

New-on-Git commented 3 years ago

i have version v4.1.3 i think

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

dolejska-daniel commented 3 years ago

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

New-on-Git commented 3 years ago

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

dolejska-daniel commented 3 years ago

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

New-on-Git commented 3 years ago

Yes and it's still not working

dolejska-daniel commented 3 years ago

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
New-on-Git commented 3 years ago

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 : {}

dolejska-daniel commented 3 years ago

Try this instead:

composer require dolejska-daniel/riot-api:v5.0.0-alpha
New-on-Git commented 3 years ago

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

New-on-Git commented 3 years ago

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 ?

dolejska-daniel commented 3 years ago

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 👍🏽

New-on-Git commented 3 years ago

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.

dolejska-daniel commented 3 years ago

Does this mean that the issue has been solved? 😄

New-on-Git commented 3 years ago

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

dolejska-daniel commented 3 years ago

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

New-on-Git commented 3 years ago

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 !