• Reading time ~ 1 min
  • 20.02.2023

Padlock is a Laravel Zero command by Daniel Mason for encrypting and decrypting environment files powered by Laravel's encryption commands. Since it's installed globally via composer, you can use it to encrypt files in the current working directory for any project:

$ padlock env:encrypt --env=testing

INFO  Environment successfully encrypted.

  Key ................ base64:RR480kEd+Yen6cCMkXmmGUz38cJYwlP/qNctQ7MA6zo=
  Cipher ............. AES-256-CBC
  Encrypted file ..... .env.testing.encrypted

And here's an example command for decrypting the above-encrypted environment file:

$ padlock env:decrypt --env=testing --key=base64:RR480kEd+Yen6cCMkXmmGUz38cJYwlP/qNctQ7MA6zo=

INFO  Environment successfully decrypted.

Decrypted file ..... .env.testing

What is neat about this package is that it's globally available but uses the Laravel framework commands under the hood to power the encryption/decryption operation. That means you could use this CLI to encrypt non-Laravel and non-PHP envrionment files.

You can get started with this CLI by installing it globally on your machine:

$ composer global require fidum/padlock

Since this CLI uses Laravel's artisan commands, see the Encrypting environment files documentation for further details.

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297