How to Generate App Key in Laravel?

03-Aug-2022

.

Admin

How to Generate App Key in Laravel?

Hello Friends,

Today our leading topic is laravel generate app key. I explained simply step by step how to generate an app key in laravel. I’m going to show you about how to create an app key in laravel. if you have a question about how to generate a key in laravel then I will give a simple example with a solution.

You can use this example with laravel 6, laravel 7, laravel 8 and laravel 9 version.

When you installed laravel app or clone laravel app from GitHub then you must need to generate API key for laravel app. laravel provides to generate API key using the artisan command to generate API key.

let's see below command to generate api key.

Generate App Key


In this step, we will see how to Generate App Key using the artisan command

php artisan key:generate

this command sets the APP_KEY value in your .env file

.env

APP_KEY=base64:yLzjwKxQSVsHhNm1MtbOcDSDvtDLh3FIpfvqgq2ao7E=

now it works...

I hope it can help you...

#Laravel