How to Generate App Key in Laravel?
In this example, let's see how to generate app key in laravel. you will learn how to create app key in laravel. We will look at an example of laravel generate app key. We will look at an example of laravel create app key.
You can use this command with laravel 6, laravel 7, laravel 8, laravel 9 and laravel 10 versions.
Laravel provides an encrypted app key in laravel. Every laravel project has its own app key. Based on app key they will generate password, encrypt data etc. so when you get fresh laravel then provide APP_KEY variable on .env file with encrypted value. But when you clone repository from github, gitlab or anywhere then you have to generate new APP_KEY using laravel command.
If you created a .env file and you don't have APP_KEY yet then you will also find "no application encryption key has been specified." error.
So you can generate the app key using the below command:
Generate App Key Command:
run the below command to generate the app key in laravel.
php artisan key:generate
Then you will see on following .env file with updated value on APP_KEY variable.
I hope you get it.
It can help you...
We are Recommending you
- How to Get All Models in Laravel?
- How to Get Columns Names from Model in Laravel?
- How to Create Model in Laravel using Command?
- Laravel Ajax PUT Request Example Tutorial
- How to Get Environment Variable in Laravel React JS?
- How to Store Array in Database Laravel?
- Laravel Google Pie Chart Example Tutorial
- Laravel Group By with Max Value Query Example
- How to Create Seeder with JSON data in Laravel?
- Laravel Summernote Image Upload Example
- How to Install and Use Memcached in Laravel?
- Laravel Fullcalendar Example Tutorial