承接 skauk/composer-auth-dotenv 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

skauk/composer-auth-dotenv

最新稳定版本:1.0

Composer 安装命令:

composer require skauk/composer-auth-dotenv

包简介

A composer install helper for private packages

README 文档

README

Packagist version MIT license Build Status Coverage Status Packagist downloads

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 repositories section inside composer.json. Find more about Composer repositories in the Composer documentation.
  • Configure authentication using composer config. This will create an auth.json file. Different supported options are described in the Composer documentation
  • Convert auth.json content to COMPOSER_AUTH environment variable format and append it to your .env file:
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

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 17
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-16