Home Laravel How to Generate App Key in Laravel?

How to Generate App Key in Laravel?

by Shahriar Sagor
Generate App Key

This topic only for the beginner. Today now in this example, i will show you how to generate the app key in laravel application. From here you will learn about how to create app key in laravel. Here We will look at an example of how to laravel generate app key. We will know an example of laravel create app key.

Here this is we can use with any version as laravel 6, laravel 7, laravel 8 and laravel 9 .

We know Laravel is provides an encrypted app key in laravel application. Every laravel project has its own app key. Based on app key it will generate the password, encrypt data etc. so when we get the fresh laravel then provide APP_KEY variable on .env file also with encrypted value. But when we are clone the repository from github, gitlab or anywhere then we need to generate new APP_KEY by using laravel command.

If we are created a .env file and we don’t have any APP_KEY yet then we will also find “no application encryption key has been specified.” error.

So we can generate the app key by using the below command:

Generate App Key Command:

Just need to run the below command to generate the app key in laravel application.

php artisan key:generate

Then we will see this on following .env file with the updated value on APP_KEY variable.



Read Also : How To Take Photo In Webcam and Save From Camera Laravel 9 ?

Thanks for read. I hope it help you. For more you can follow us on facebook


You may also like