rto-websites/laravel-credentials
Composer 安装命令:
composer require rto-websites/laravel-credentials
包简介
Store and access encrypted credentials in your Laravel application.
README 文档
README
Since the original package does not seem to be maintained any more, this is an adaptation of the beyondcode/laravel-credentials package. See here 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
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:
<?php return [ /* * Defines the file that will be used to store and retrieve the credentials. */ 'file' => config_path('credentials.php.enc'), /** * */ 'editor' => env('CREDENTIALS_EDITOR', 'vi'), /* * 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'), ];
Migration
If you are about to move over from the original package to this one you may need to make some minor adjustments to your project.
In most cases all you have to do are the following three steps:
- run
composer require rto-websites/laravel-credentials - remove
beyondcode/laravel-credentialsfrom youcomposer.json - run
composer update beyondcode/laravel-credentials
If you published the config file you will need to add this line to your config/credentials.php:
'editor' => env('CREDENTIALS_EDITOR', 'vi'),
If you are not using the package auto-discovery and registering the service provider by hand
you will need make a small adjustment to your registration since the service provider's namespace
has changed.
Go to your config/app.php and replace
BeyondCode\Credentials\CredentialsServiceProvider::class with RtoWebsites\Credentials\CredentialsServiceProvider::class.
Testing
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 marcel@beyondco.de instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
rto-websites/laravel-credentials 适用场景与选型建议
rto-websites/laravel-credentials 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 435 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Laravel-Credentials」 「rto-websites」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rto-websites/laravel-credentials 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rto-websites/laravel-credentials 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rto-websites/laravel-credentials 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
统计信息
- 总下载量: 435
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-04
