1

I am setting up a local development environment for Laravel project and I'm trying to set it up as ready as possible meaning that I want other developers to do minimum effort to start developing locally.

So, in this context, I am thinking that I can put my local APP_KEY in .env.example file so that other developers don't have to run php artisan key:generate

Is it a valid thought, would this be a problem, does each developer "have to" generate his/her own key in order to work properly locally?

Note: I have examined the answer here When to generate a new Application Key in Laravel?

Adem Tepe
  • 564
  • 5
  • 10
  • 1
    The `APP_KEY` is used for encryption within Laravel (sessions, csrf tokens, etc.). If you were serving your application on multiple servers you would use the same key, but I don't see a requirement to share keys during development. – Peppermintology Feb 07 '21 at 14:32
  • Well, it's not a requirement but I was just trying to understand it better and skip one step for local environment setup. – Adem Tepe Apr 03 '21 at 16:00

1 Answers1

1

It is OK.

Since Laravel uses APP_KEY for encrypting cookies (I've just learnt that) including session cookie, it doesn't matter if the developers are using the same APP_KEY in their local environment.

On the other hand, it is important to produce new APP_KEY for the production environment and even change it regularly.

My resource: https://tighten.co/blog/app-key-and-you/

Adem Tepe
  • 564
  • 5
  • 10