Skip to content

LeagueAPI: StaticData endpoints

Daniel Dolejška edited this page Jan 7, 2019 · 3 revisions

Version v3.0.0

StaticData endpoints provide you with easy way to transform StaticData into object instances and work with them. Almost all StaticData endpoints require DataDragonAPI to be initialized, if it's not initialized and StaticData call is initiated an exception is thrown.

You can initialize DataDragon by yourself (see How to begin with DataDragonAPI for more information about that option) or you can use LeagueAPI::SET_DATADRAGON_INIT option as shown below.

Settings key Data type Info / Possible values
LeagueAPI::SET_DATADRAGON_INIT bool default false true, false
Optional. Specifies whether or not should DataDragonAPI be initialized by this library.
LeagueAPI::SET_DATADRAGON_PARAMS array Optional. Specifies parameters passed to DataDragonAPI when initialized.

Library initialization

use RiotAPI\LeagueAPI\LeagueAPI;

$api = new LeagueAPI([
	// ...
	LeagueAPI::SET_DATADRAGON_INIT => true,
	// ...
]);

And that's all what's necessary for StaticData calls to be available through LeagueAPI.

You can also provide DataDragonAPI with any parameters you wish:

use RiotAPI\DataDragonAPI\DataDragonAPI;
use RiotAPI\LeagueAPI\LeagueAPI;

$api = new LeagueAPI([
	// ...
	LeagueAPI::SET_DATADRAGON_INIT   => true,
	LeagueAPI::SET_DATADRAGON_PARAMS => [
		// ...
		DataDragonAPI::SET_DEFAULT_CLASS => "custom-class",
		// ...
	],
	// ...
]);