Download the PHP package aysnc/composer-env-auth without Composer
On this page you can find all versions of the php package aysnc/composer-env-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aysnc/composer-env-auth
More information about aysnc/composer-env-auth
Files in aysnc/composer-env-auth
Package composer-env-auth
Short Description Composer plugin that reads authentication credentials from environment variables and .env files
License MIT
Homepage https://github.com/Aysnc-Labs/composer-env-auth
Informations about the package composer-env-auth
Composer Environment Authentication Plugin
Streamline your Composer authentication with environment variables
Are you managing separate .env files alongside auth.json files for your Composer authentication? This plugin eliminates that redundancy by bringing industry-standard environment variable support directly to Composer's authentication system.
While we await native environment variable support in Composer core, this plugin bridges the gap by allowing you to store all your authentication credentials securely in environment variables — just like every other modern development tool.
Features
- 🔐 Unified Authentication: Store all credentials in environment variables
- 🚀 Zero Configuration: Works automatically once installed
- 🎯 Multiple Auth Types: Supports GitHub OAuth, GitLab tokens, and HTTP Basic auth
- 📁 Project-Aware: Automatically finds your project root and
.envfile - ⚡ Lightweight: Minimal overhead, maximum convenience
Installation
Install the plugin as a development dependency in your project. Do this before installing any plugins:
Quick Start
-
Add authentication configuration to your
composer.json: -
Set your credentials in your
.envfile: - Run Composer commands as usual:
The plugin automatically applies your environment-based authentication!
Configuration Examples
HTTP Basic Authentication (Generic)
GitHub Personal Access Token
GitLab Private Token
Multiple Repositories
How It Works
- Plugin Activation: Automatically activated when Composer initializes
- Configuration Discovery: Scans
composer.jsonfor repositories withaysnc/env-authoptions - Environment Resolution: Resolves variables from system environment and
.envfiles - Authentication Configuration: Dynamically configures Composer's authentication system
- Seamless Integration: Standard Composer commands operate with authenticated access
CI/CD Pipeline Integration
The plugin seamlessly integrates with CI/CD environments where .env files may not be present:
System environment variables are automatically detected and utilized without requiring local .env files.
Environment Variable Priority
The plugin resolves environment variables in the following order of precedence:
- System environment variables (
$_ENV,$_SERVER) - highest priority - Variables from
.envfile in your project root - fallback
This hierarchy ensures that system-level configuration (such as CI/CD pipeline variables) takes precedence over local development settings, while maintaining backwards compatibility with existing .env file workflows.
Supported Authentication Types
| Service | Configuration | Environment Variable Format |
|---|---|---|
| Generic | {"username": "USER_VAR", "password": "PASS_VAR"} |
Username/Password or Token |
| GitHub | "GITHUB_TOKEN" |
Personal Access Token |
| GitLab | "GITLAB_TOKEN" |
Private Token |
Why This Plugin?
The Challenge: Traditional Composer authentication requires maintaining separate auth.json files alongside application .env configurations, resulting in:
- Fragmented credential management workflows
- Increased risk of credential exposure in version control
- Inconsistent authentication patterns across development tools
- Complex CI/CD configuration requirements
Our Solution: This plugin aligns Composer with industry-standard practices by implementing comprehensive environment variable support for authentication workflows.
Looking Forward: While we anticipate eventual native environment variable support in Composer core, this plugin provides an immediate, production-ready solution that standardizes authentication practices across modern development workflows.