Laravel
This document provides instructions for working with Laravel and the CommandK CLI. It explains how to run your Laravel application and manage secrets effectively using the CommandK CLI.
Prerequisites
Before you begin the integration process, make sure you have the following:
- API Access Token: To authenticate your Laravel application with CommandK, you'll need an API access token. If you haven't obtained one yet, refer to this link for instructions on how to acquire it.
Integration Steps
Follow these steps to integrate CommandK with your Laravel application:
Step 1: Create a Laravel Application
If you haven't already created a Laravel application, you can set up a new project using the Laravel CLI or any other preferred method. Here, we'll use the Laravel CLI for demonstration:
-
Install the Laravel CLI globally if you haven't already:
composer global require laravel/installer
-
Create a new Laravel project using the following command:
laravel new my-laravel-app
Replace
my-laravel-app
with your desired project name. -
Navigate to the project directory:
cd my-laravel-app
Step 2: Access Secrets in Your Laravel Application
Inside your Laravel application, you can access secrets as environment variables. Open the appropriate file (e.g., .env
) and add the following code snippet to access an environment variable:
SECRET_KEY={{COMMANDK_SECRET_KEY}}
In this code, COMMANDK_SECRET_KEY
is the environment variable that will store your secret.
Running Your Laravel Application
To run your Laravel application with the CommandK CLI, you can use the following command:
$ cmdk run <application-name> --environment development -- php artisan serve
Replace <application-name>
with the actual name of your Laravel application. This command will execute your Laravel application, running the development server.
By following these instructions, you can seamlessly integrate the CommandK CLI with your Laravel application, making it easy to manage secrets and run your application securely.
Updated about 2 months ago