Search code examples
laravelenvironment-variableslocallaravel-5.8

Is it ok if more than one developer use the same APP_KEY in Laravel for local development?


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?


Solution

  • 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/