PHPackages                             rto-websites/laravel-credentials - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. rto-websites/laravel-credentials

ActiveLibrary[Security](/categories/security)

rto-websites/laravel-credentials
================================

Store and access encrypted credentials in your Laravel application.

2.1.0(6y ago)1435MITPHPPHP ^7.1CI failing

Since May 15Pushed 6y ago5 watchersCompare

[ Source](https://github.com/RTO-Websites/laravel-credentials)[ Packagist](https://packagist.org/packages/rto-websites/laravel-credentials)[ Docs](https://github.com/RTO-Websites/laravel-credentials)[ RSS](/packages/rto-websites-laravel-credentials/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (8)Used By (0)

Add encrypted credentials to your Laravel production environment
================================================================

[](#add-encrypted-credentials-to-your-laravel-production-environment)

[![Latest Version on Packagist](https://camo.githubusercontent.com/efd56f2685e005204228567a21671e678752e907948ba9259243f6927539b4ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72746f2d77656273697465732f6c61726176656c2d63726564656e7469616c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rto-websites/laravel-credentials)[![Build Status](https://camo.githubusercontent.com/602481393fbb12460889b07058a6885536c83c53449646497d2bcf6fd2dcc719/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f72746f2d77656273697465732f6c61726176656c2d63726564656e7469616c732f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/rto-websites/laravel-credentials)[![Quality Score](https://camo.githubusercontent.com/98b8d73b7165f4c64ac1bac14651689f39d22386b2d79c6e3b5a3a15fba00805/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f72746f2d77656273697465732f6c61726176656c2d63726564656e7469616c732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/rto-websites/laravel-credentials)[![Total Downloads](https://camo.githubusercontent.com/64518a48e0c55d809766d03ea275fe1fabd08d29413fb41e92930bfbdf6cf88e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72746f2d77656273697465732f6c61726176656c2d63726564656e7469616c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rto-websites/laravel-credentials)

---

Since the [original package](https://github.com/beyondcode/laravel-credentials) does not seem to be maintained any more, this is an adaptation of the `beyondcode/laravel-credentials` package. See [here](#migration) how to migrate.

---

The `rto-websites/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`:

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

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

```
$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.

```
php artisan credentials:edit
```

[![Credentials Demo](https://github.com/RTO-Websites/laravel-credentials/raw/master/credentials.gif)](https://github.com/RTO-Websites/laravel-credentials/blob/master/credentials.gif)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require rto-websites/laravel-credentials
```

The package will automatically register itself.

You can optionally publish the configuration with:

```
php artisan vendor:publish --provider="RtoWebsites\Credentials\CredentialsServiceProvider" --tag="config"
```

This is the content of the published config file:

```
