Skip to content

Blockade-Games/BlockadeLabs-SDK-Laravel-Boilerplate

Repository files navigation

Blockade Labs SDK Laravel Boilerplate

This boilerplate can serve as a type of API proxy for accessing Blockade Labs API routes for generating skyboxes and imagine requests.

Versions and dependencies

Boilerplate uses:

Cloning the repository

Refer to GitHub docs on how to clone a repo.

Getting Started

After you have cloned the repo, copy the .env.example file and rename it to .env. Next, you need to edit your .env file and add your Blockade Labs API key:

BLOCKADE_LABS_API_KEY=YOUR_API_KEY

Install dependencies with:

composer install

Set the application key if needed:

php artisan key:generate

Cache the new configuration if needed:

php artisan config:cache

Depending on the environment you may optionally run PHP server locally:

php artisan serve

Usage

Routes are defined in api.php file, they are matching the same structure as the original API routes from Blockade's API.

In the VerifyCsrfToken currently an exception for the API routes is added like so api/v1/*, so basically any API requests won't be requiring the CSRF token.

Main files that are added to boilerplate are SkyboxController and ImagineController and there you can manipulate the data that is sent and received, if needed. Both files are using a Blockade Labs SDK package and are importing a facade that is in charge of communicating with the original API.

use BlockadeLabs\SDK\Facades\BlockadeLabsClient;

All the methods and routes are also explained (in greater detail) in the Docs here.