How to Generate App Key in Laravel Code Example

Aug 03, 2022 . Admin

Hello Friends,

Now, let's see tutorial of How to Generate App Key in Laravel Code Example. We will look at example of how to generate app key in laravel. I would like to share with you how to generate key in laravel. step by step explain how to generate new app key in laravel. Here, Creating a basic example of laravel create new app key.

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 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