I am using php artisan key:generate
for generating AES key,but it updating env file each time.
I need to generate a unique AES key for a chatroom.
Any suggestion will be appreciated.
If you take a look at the source of this command, you can find the function that is used to generate this key. If you want to use this key for something else, you can reuse this function.
protected function generateRandomKey()
{
return 'base64:'.base64_encode(
Encrypter::generateKey($this->laravel['config']['app.cipher'])
);
}