How to generate .env file for laravel?

前端 未结 10 1061
不知归路
不知归路 2020-12-24 05:39

From the documentation I see it\'s possible to create a laravel project via laravel installer:

$laravel new blog

or via composer:



        
10条回答
  •  悲&欢浪女
    2020-12-24 06:31

    Just tried both ways and in both ways I got generated .env file:

    enter image description here

    Composer should automatically create .env file. In the post-create-project-cmd section of the composer.json you can find:

    "post-create-project-cmd": [
      "php -r \"copy('.env.example', '.env');\"",
      "php artisan key:generate"
    ]
    

    Both ways use the same composer.json file, so there shoudn't be any difference.

    I suggest you to update laravel/installer to the last version: 1.2 and try again:

    composer global require "laravel/installer=~1.2"
    

    You can always generate .env file manually by running:

    cp .env.example .env
    php artisan key:generate
    

提交回复
热议问题