Created
October 9, 2024 15:03
-
-
Save Braunson/5f78fb01abfc950d9f529a4f93b612f2 to your computer and use it in GitHub Desktop.
Copy .env.example to .env and generate an APP_KEY when not set on the Composer post-install-cmd hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"post-install-cmd": [ | |
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"", | |
"@php -r \"if (strlen(trim(file_get_contents('.env'))) > 0 && !preg_match('/^APP_KEY=.+/m', file_get_contents('.env'))) { echo shell_exec('php artisan key:generate --ansi'); }\"", | |
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment