Lumen Micro Framework => php artisan key:generate

后端 未结 12 855
遥遥无期
遥遥无期 2021-01-30 00:59

I\'m trying out the PHP micro Framework Lumen (from Laravel).

One of my first steps was to look into the .env.example file and make a copy of it to have my

12条回答
  •  庸人自扰
    2021-01-30 01:25

    This answer was inspired by @thomas-venturini 's update to the question. Here's a bash script that takes care of creating .env and updating it with an APP_KEY using the aforementioned PHP command and the UNIX sed command:

    #!/usr/bin/env bash
    
    function generate_app_key {
        php -r "echo md5(uniqid()).\"\n\";"
    }
    
    APP_KEY=$(generate_app_key)
    
    sed -e s/APP_KEY=.*$/APP_KEY=${APP_KEY}/g .env.example > .env
    

    Hope someone finds this useful.

提交回复
热议问题