Skip to content

Lupennat/laravel-env-enc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-env-enc

GitHub license

This package allows you to Encrypt/Decrypt your .envs file in Laravel.

Install

$ composer require lupennat/laravel-env-enc

Generate a valid key

Generate a new key based on config.app.chiper.

$ php artisan lupennat:env-generate-key

nvK/Ay8HrB+3SAYnWSehUYajMqceBdpwvp45U3cYWd4=

Store your key outside the laravel project.

Encrypt/Decrypt file .env

$ php artisan lupennat:env-encrypt
Provide a key:
 > nvK/Ay8HrB+3SAYnWSehUYajMqceBdpwvp45U3cYWd4=
Which key cipher? [AES-256-CBC]:
  [0] AES-128-CBC
  [1] AES-256-CBC
 > 1
File /xxx/.env.enc succesfully created!
$ php artisan lupennat:env-decrypt
Provide a key:
 > nvK/Ay8HrB+3SAYnWSehUYajMqceBdpwvp45U3cYWd4=
Which key cipher? [AES-256-CBC]:
  [0] AES-128-CBC
  [1] AES-256-CBC
 > 1
File /xxx/.env succesfully created!

Manage multiple .env

$ php artisan lupennat:env-encrypt local
Provide a key:
 > nvK/Ay8HrB+3SAYnWSehUYajMqceBdpwvp45U3cYWd4=
Which key cipher? [AES-256-CBC]:
  [0] AES-128-CBC
  [1] AES-256-CBC
 > 1
File /xxx/.env.local.enc succesfully created!
$ php artisan lupennat:env-decrypt local
Provide a key:
 > nvK/Ay8HrB+3SAYnWSehUYajMqceBdpwvp45U3cYWd4=
Which key cipher? [AES-256-CBC]:
  [0] AES-128-CBC
  [1] AES-256-CBC
 > 1
File /xxx/.env.local succesfully created!
$ cp .env.local .env
$ cp .env.prod .env
$ cp .env.xxx .env

Hide sensitive data

add these lines in the .gitignore file

.env*
!.env.*.enc

Encrypt your env files and push on your repository.

License

MIT

About

Encrypt your .env file in Laravel

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages