Laravel Credentials Package for Encrypted Application Secrets

综合编程 2018-05-16 阅读原文

Trust me, erasing secret data
from version control is open-heart surgery for your VCS you never want to perform. On the other hand, having secrets in version control is helpful to keep track of changes made, given that you do so carefully. Enter Laravel Credentials.

Laravel Credentials is a new package by Marcel Pociot (ofBotman fame) to help you manage sensitive data securely in your Laravel project.

A couple of benefits include:

  • Credentials are encrypted, so nobody can read them without the key (which you should not store in version control)
  • Encrypted credentials are in version control, so you have a history of change
  • You can deploy credential changes along with code changes
  • Your secrets exist in one location

Since credentials are encrypted and require a key, how do you edit them with this package?

Editing Laravel Credentials

To edit your credentials, you use an artisan command provided by the Laravel Credentials package:

php artisan credentials:edit

Once you update the credentials, the new encrypted version gets stored in the credentials file (by default the file lives at config/credentials.php.enc
. The credentials file is accessible via helpers.

Using Credentials

To access encrypted credentials, you use the provided credentials()
helper function:

$credential = credentials('api-password');


To install this package and start using it, install it via composer with:

composer require beyondcode/laravel-credentials

You can optionally publish the config file with the following:

php artisan vendor:publish --provider="BeyondCodeCredentialsCredentialsServiceProvider" --tag="config"

Learn More

Learn more about the Laravel Credentials package and access the source code from beyondcode/laravel-credentials
on GitHub.

You might already be familiar with the encrypted file approach for sensitive data if you’ve used Ansible Vault

Laravel News

责编内容by:Laravel News阅读原文】。感谢您的支持!


Just In Case. Laravel, handling active menu item About Just In Case While studying Laravel framework I faced with some not an obvious for me problem...
How to Set Up a Full-Text Search Using Scout in La... Full-text search is crucial for allowing users to navigate content-rich websites. In this post, I'll show you how to imp...
Laravel 用户授权系统使用小结 官方文档 Laravel 5.5 文档 基本用法 示例 $this->au...
When developing Laravel app with Vim, you can stil... I am developing Laravel app with my favorite editor, Vim. My compulsion was that I cannot jump to Laravel's magi...
动态修改 Laravel Config 配置项 感谢以下网站提供的帮助 基于 Laravel 开发过程中,ThinkSNS+ 是如何做到 Laravel 配置可以网站后台配置的。 Laravel 的 config 配置文件都是写死在 php 文件中,一般人...