百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
L

laravel-credentials

> 编程语言
开源

将加密凭据添加到您的 Laravel 生产环境中。

578 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

将加密凭据添加到您的 Laravel 生产环境中。

Add encrypted credentials to your Laravel production environment

The beyondcode/laravel-credentials package allows you to store all your secret credentials in an encrypted file and put that file into version control instead of having to add multiple credentials into your .env file in your production environment.

There are a couple of benefits of using encrypted credentials instead of environment keys:

  • Your credentials are encrypted. No one will be able to read your credentials without the key.
  • The encrypted credentials are saved in your repository. You'll have a history of the changes and who made them.
  • You can deploy credentials together with your code.
  • All secrets are in one location. Instead of managing multiple environment variables, everything is in one file.

Here's how you can access your stored credentials. In this example we're retrieving the decrypted credential for the key api-password:

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

You can also specify a fallback value to be used if the credential for the specified key cannot be decrypted:

php
$credential = credentials('my-production-token', 'my-fallback-value');

With the built-in edit command, you can easily edit your existing credentials. They will be automatically encrypted after saving your changes.

bash
php artisan credentials:edit

Optionally, you can change the used editor by adding the following to your .env file:

EDITOR=nano

Installation

You can install the package via composer:

bash
composer require beyondcode/laravel-credentials

The package will automatically register itself.

You can optionally publish the configuration with:

bash
php artisan vendor:publish --provider="BeyondCode\Credentials\CredentialsServiceProvider" --tag="config"

This is the content of the published config file:

php
 config_path('credentials.php.enc'),

    /*
     * Defines the key that will be used to encrypt / decrypt the credentials.
     * The default is your application key. Be sure to keep this key secret!
     */
    'key' => config('app.key'),

    'cipher' => config('app.cipher'),

];

Testing

bash
composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

  • Marcel Pociot
  • All Contributors

License

The MIT License (MIT). Please see License File for more information.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHP

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言