skauk/composer-auth-dotenv
最新稳定版本:1.0
Composer 安装命令:
composer require skauk/composer-auth-dotenv
包简介
A composer install helper for private packages
README 文档
README
This Composer plugin lets you store credentials for private packages in a .env file, using the same format as the COMPOSER_AUTH environment variable. This approach avoids using auth.json, keeps credentials out of version control, and makes them easier to manage and encrypt alongside other environment-specific configuration.
This repository is inspired by private-composer-installer.
Motivation
In Laravel ecosystem there are many commercially distributed packages that require authentication to be installed.
The usual way to authenticate is to use the auth.json file, which is then ignored (or not) by version control.
It is more practical, however, to be able to store credentials in a .env file, which is already used for other environment-specific configuration.
The .env file can be encrypted and decrypted using the php artisan env:encrypt and php artisan env:decrypt commands.
The encryption key can be shared with team members to securely grant access to all necessary project secrets.
This might make it easier and safer to manage composer credentials in your development team.
Setup
- Add the desired private package to the
repositoriessection insidecomposer.json. Find more about Composer repositories in the Composer documentation. - Configure authentication using
composer config. This will create anauth.jsonfile. Different supported options are described in the Composer documentation - Convert
auth.jsoncontent to COMPOSER_AUTH environment variable format and append it to your.envfile:
echo -n "COMPOSER_AUTH=" >> .env && cat auth.json | tr -d '\n[:space:]' >> .env
Configuration
The configuration options listed below may be added to the extra section of composer.json like so:
{
"name": "...",
"description": "...",
"require": {
},
"extra": {
"composer-auth-dotenv": {
"dotenv-path": ".",
"dotenv-name": ".env"
}
}
}
dotenv-path
Dotenv file directory relative to the root path (where composer.json is located).
By default, dotenv files are expected to be in the root folder.
dotenv-name
Dotenv file name. Defaults to .env.
统计信息
- 总下载量: 2.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-16