Tuesday, 2 May 2023

Laravel encryp .env file

 => " Laravel allows you to encrypt your environment files 

   so that they may safely be added to source control with the rest of your application. "

   

  1) Encryption


   => To encrypt an environment file, you may use the env:encrypt command:

     

   php artisan env:encrypt


=> Running the env:encrypt command will encrypt your .env 

   file and place the encrypted contents in an .env.encrypted file. 

   

=> The decryption key is presented in the output of the command and should 


=> "If you would like to provide your own encryption key 

   you may use the --key "

   

   php artisan env:encrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF

   

=> "encrypted by providing the environment name via the --env option: "

  php artisan env:encrypt --env=staging


2) Decryption


  => To decrypt an environment file,

  

  php artisan env:decrypt

  

  => Or, the key may be provided directly to the command via the 

     --key option

    

  php artisan env:decrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF

  

  => specify the environment file that should be decrypted

  

   "php artisan env:decrypt --env=staging"


   be stored in a secure password manager.

No comments:

Post a Comment

Other post

1) The create() Method The  create()  method is a powerful and convenient way to store data in your Laravel application. It is typically use...