Gamefy is a simple application built in Laravel that can fetch the games stored in IGDB database via API. It was created to learn more about HTTP client, Tailwind CSS, Livewire and Alpine.js.
To setup the application, you should install the dependencies and configure an API key for IGDB. To install the dependencies, follow the steps:
- Open your terminal and locate the project's folder
- Run php composer.phar install (or composer install if you have Composer installed globally)
- Create a .env file with command: cp -R .env.example .env
- Generate the application key with: php artisan key:generate
- Give permissions to the folders: chmod 0777 -R bootstrap/ storage/ database/
To create your own API key, you should follow the steps:
- Sign Up with Twitch for a free account
- Ensure you have Two Factor Authentication enabled
- Register your application
- Manage your newly created application
- Generate a Client Secret by pressing [New Secret]
- Take note of the Client ID and Client Secret
With your ClientID and ClientSecret, you can use Insomnia to make a POST request to the access token endpoint: https://id.twitch.tv/oauth2/token
POST https://id.twitch.tv/oauth2/token?
client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET
&grant_type=client_credentials
You should receive your access token in the request. After getting the Access Token, simple add it to the IGDB parameters in .env file.
IGDB_API_ENDPOINT=https://api.igdb.com/v4/games
IGDB_CLIENT_ID=YOUR_CLIENT_ID
IGDB_TOKEN=YOUR_ACCESS_TOKEN
So that's it! You're ready to go!
If you want to test the application, use the following command:
php artisan test