Creating the Client
Before you can request data from the API you'll need to insert your API keys into the app. This is done using Environment variables.
The cool thing about using environment to load the framework is that you'll have to write zero code to initialize the framework and start making requests.
Setting up the Environment
There process of using environment variables might seem scary at first, but it makes managing your API keys safer and simpler.
Usually the environment is loaded from a file. If you already know how to load variables into the environment you can skip to the list of required variables.
Loading variables from File
To load variables from file you need to create a
.env file. This can be put anywhere, but if it's outside of RiotQuest's root you'll have to load the file yourself.
Loading the file yourself is a really simple process. RiotQuest depends on
symfony/dotenv to load environment variables. Just take a look at their tutorial for loading variables from a file.
As mentioned, if the file is placed inside the same directory as RiotQuest the framework will automatically find the file and load the variables. The framework directory root is the same one which as the
src/ folder in it as well as a
Here's a table of every environment variable RiotQuest utilizes.
||Decide whether to load the framework using environment variables or not.|
||The raw API key for all standard Riot Games APIs|
||The raw API key for tournament APIs. (Not required)|
||The rate limits on the regular API key, in
||The rate limits on the tournament API key, in
After we've set up our environment variables we need to boot the client. This is with a single function which takes care of everything.
Simply run the boot function.
Your client is now ready to be used.
Now that you know how to bootstrap the Client, you'll want to take a look at how you'll send a request using the Client you've just set up!