-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to use a local data dragon ? #66
Comments
Hey, that is a pretty good question! Without any library code change it is possible but in a restricted way - if you override DataDragonAPI::initByVersion('custom_version_string', [
DataDragonAPI::SET_ENDPOINT => 'http://localhost/riot-api-files/',
]); All the generated URLs will then contain this one as a base path instead of Eg. for champion icons its: "{$endpoint}{$version}/img/champion/{$champion_name}.png"; |
thanks for the reply ! I will try to implement this . |
Just did it ! thanks again! , but one more question. |
@Lucasnl, it pretty much depends on your setup - what server do you use, what does the page do - I can't judge without any additional information. |
@dolejska-daniel Im using localhost / Xampp |
That doesn't tell me anything about your code 😅. 12 seconds is very long, so either you are doing something wrong or you've got something configured wrong. |
well Here's an example , i have a input to search players match history so ... if ($player ) { now im doing a foreach to get all the detailed infos about the game foreach ($games as $game) { $ranked = $game->queue; // and now I have another foreach inside this foreach to access all the info about the player id foreach ($getAllPlayers as $player) $participantMatchId= $player->participantId; // and another foreach inside this foreach to get the stats and items about the game foreach ($stats as $stat){ $WinorLose= $stat->stats->win; $item0 = $stat->stats->item0 } and that's it , I don't know if a foreach inside another foreach is a problem or |
Ok, I can see why this could take a lot of time since you are querrying the API separately for each game from matchlist. You could probably use async requests to speed up the process but you'd have to change your code a bit. |
Thanks for the reply! I will try ! |
Hey its me again ,I promise this is the last time I bother you 😅 I tried to follow your the example from the Async request , I'm doing the league api initializating with my riot key , but all im getting is a blank page , im not getting the output : I am TheKronnY (level 69) is there any other config I have to make ? |
@Lucasnl these summoner names are from EUNE region - that is important. |
Btw code utilizing asynchronous requests would look something like this for case you presented: $player = $_POST['searchPlayer'];
if ($player)
{
$getSummoner = $api->getSummonerByName($player);
$sumId = $getSummoner->accountId;
$getGames = $api->getMatchlistByAccount($sumId);
$games = $getGames->matches;
}
$onSuccess = function( Objects\MatchDto $infoGame ) {
$getAllPlayers = $infoGame->participantIdentities;
$stats = $infoGame->participants;
foreach ($getAllPlayers as $player)
{
$participantMatchId = $player->participantId;
foreach ($stats as $stat)
{
$WinorLose = $stat->stats->win;
$item0 = $stat->stats->item0;
$item1 = $stat->stats->item1;
// ...
}
}
};
$onFailure = function( $ex ) {
echo "Error occured: {$ex->getMessage()}";
};
foreach ($games as $game)
{
$ranked = $game->queue;
$gameId = $game->gameId;
$api->nextAsync($onSuccess, $onFailure);
$infoGame = $api->getMatch($gameId);
}
$api->commitAsync(); |
thanks for the help ! |
@Lucasnl there has been a mistake in my code - last line is supposed to be |
I'm assuming this has been solved. |
I just downloaded the data dragon files , and i want to know if it's possible (and easy to implement) to use the local files instead of using the cdn.
Thank you
The text was updated successfully, but these errors were encountered: