Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
L

laravel-credentials

> 编程语言
Open source

Add encrypted credentials to your Laravel production environment.

578 stars0 likes4 views
WebsiteGitHub

About

Add encrypted credentials to your Laravel production environment.

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 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHP

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

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