{"id":13760168,"url":"https://github.com/ffraenz/private-composer-installer","last_synced_at":"2025-05-16T10:08:21.088Z","repository":{"id":56656143,"uuid":"120679908","full_name":"ffraenz/private-composer-installer","owner":"ffraenz","description":"Composer install helper outsourcing sensitive keys from the package URL into environment variables","archived":false,"fork":false,"pushed_at":"2024-09-02T15:48:33.000Z","size":161,"stargazers_count":228,"open_issues_count":4,"forks_count":16,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-09T04:07:49.147Z","etag":null,"topics":["acf","composer","composer-plugin","dotenv","hacktoberfest","packagist","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ffraenz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ffraenz"]}},"created_at":"2018-02-07T22:29:58.000Z","updated_at":"2024-11-10T15:08:27.000Z","dependencies_parsed_at":"2024-10-27T18:12:39.816Z","dependency_job_id":"5d77d41a-3275-4ad6-9a25-da6e3b36e45e","html_url":"https://github.com/ffraenz/private-composer-installer","commit_stats":{"total_commits":83,"total_committers":6,"mean_commits":"13.833333333333334","dds":"0.10843373493975905","last_synced_commit":"3f1b7a09a8d08cd130bf6b5e25012fe68b664767"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffraenz%2Fprivate-composer-installer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffraenz%2Fprivate-composer-installer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffraenz%2Fprivate-composer-installer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ffraenz%2Fprivate-composer-installer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ffraenz","download_url":"https://codeload.github.com/ffraenz/private-composer-installer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509477,"owners_count":22082892,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acf","composer","composer-plugin","dotenv","hacktoberfest","packagist","wordpress"],"created_at":"2024-08-03T13:01:04.699Z","updated_at":"2025-05-16T10:08:16.072Z","avatar_url":"https://github.com/ffraenz.png","language":"PHP","funding_links":["https://github.com/sponsors/ffraenz"],"categories":["Plugins","PHP"],"sub_categories":["Support"],"readme":"# private-composer-installer\n\n[![Packagist version](https://img.shields.io/packagist/v/ffraenz/private-composer-installer.svg?maxAge=3600)](https://packagist.org/packages/ffraenz/private-composer-installer)\n[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)\n[![Build Status](https://img.shields.io/github/workflow/status/ffraenz/private-composer-installer/Continuous%20Integration/master)](https://github.com/ffraenz/private-composer-installer/actions)\n[![Coverage Status](https://coveralls.io/repos/github/ffraenz/private-composer-installer/badge.svg?branch=master)](https://coveralls.io/github/ffraenz/private-composer-installer?branch=master)\n[![Packagist downloads](https://img.shields.io/packagist/dt/ffraenz/private-composer-installer.svg?maxAge=3600)](https://packagist.org/packages/ffraenz/private-composer-installer)\n\nThis is a [Composer](https://getcomposer.org/) plugin offering a way to reference private package URLs within `composer.json` and `composer.lock`. It outsources sensitive dist URL parts (license keys, tokens) into environment variables or a `.env` file typically ignored by version control. This is especially useful when you can't use [Private Packagist](https://packagist.com/) or [Basic HTTP Auth](https://getcomposer.org/doc/articles/authentication-for-private-packages.md#http-basic) because the source of a package is not in your control. This repository is inspired by [acf-pro-installer](https://github.com/PhilippBaschke/acf-pro-installer).\n\n## Quick overview\n\n- This plugin is compatible with both Composer 2.x (latest) and 1.x.\n- When installing or updating a package, the dist URL `{%VERSION}` placeholder gets replaced by the version set in the package. In Composer 1 the dist URL version gets fulfilled before it is added to `composer.lock`.\n- Before downloading the package, `{%VARIABLE}` formatted placeholders get replaced by their corresponding environment variables in the dist URL. Env vars will never be stored inside `composer.lock`.\n- If an environment variable is not available for the given placeholder the plugin trys to read it from the `.env` file in the working directory or in one of the parent directories. The `.env` file gets parsed by [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv).\n- If an environment variable can't be resolved a `MissingEnvException` gets thrown.\n- Package dist URLs with no `{%VARIABLE}` formatted placeholders get ignored by this plugin.\n\n## Examples\n\n### Arbitrary private packages\n\nAdd the desired private package to the `repositories` field inside `composer.json`. Find more about Composer repositories in the [Composer documentation](https://getcomposer.org/doc/05-repositories.md#repositories). Specify the exact version to install, and use `{%VARIABLE}` placeholders to specify any sensitive tokens in your `.env` file.\n\n```json\n{\n  \"type\": \"package\",\n  \"package\": {\n    \"name\": \"package-name/package-name\",\n    \"version\": \"REPLACE_WITH_LATEST_PACKAGE_VERSION\",\n    \"dist\": {\n      \"type\": \"zip\",\n      \"url\": \"https://example.com/package-name.zip?key={%PACKAGE_KEY}\u0026version={%VERSION}\"\n    },\n    \"require\": {\n      \"ffraenz/private-composer-installer\": \"^5.0\"\n    }\n  }\n}\n```\n\nProvide the private package dist URL inside the `.env` file:\n\n```\nPACKAGE_KEY=pleasedontusethiskey\n```\n\nLet Composer require the private package:\n\n```bash\ncomposer require \"package-name/package-name:*\"\n```\n\n### WordPress plugins\n\nWordPress plugins can be installed using the package type `wordpress-plugin` in conjunction with the `composer/installers` installer. In this example we are installing the ACF Pro plugin. Add following entry to the [repositories](https://getcomposer.org/doc/05-repositories.md#repositories) field inside `composer.json` and set the desired ACF Pro version.\n\n```json\n{\n  \"type\": \"package\",\n  \"package\": {\n    \"name\": \"advanced-custom-fields/advanced-custom-fields-pro\",\n    \"version\": \"REPLACE_WITH_LATEST_ACF_VERSION\",\n    \"type\": \"wordpress-plugin\",\n    \"dist\": {\n      \"type\": \"zip\",\n      \"url\": \"https://connect.advancedcustomfields.com/index.php?a=download\u0026p=pro\u0026k={%PLUGIN_ACF_KEY}\u0026t={%VERSION}\"\n    },\n    \"require\": {\n      \"composer/installers\": \"^1.4\",\n      \"ffraenz/private-composer-installer\": \"^5.0\"\n    }\n  }\n}\n```\n\nProvide the ACF Pro key inside the `.env` file. To get this key, login to your [ACF account](https://www.advancedcustomfields.com/my-account/) and scroll down to 'Licenses \u0026 Downloads'.\n\n```\nPLUGIN_ACF_KEY=pleasedontusethiskey\n```\n\nLet Composer require ACF Pro:\n\n```bash\ncomposer require \"advanced-custom-fields/advanced-custom-fields-pro:*\"\n```\n\n## Configuration\n\nThe configuration options listed below may be added to the root configuration in `composer.json` like so:\n\n```json\n{\n  \"name\": \"...\",\n  \"description\": \"...\",\n  \"require\": {\n  },\n  \"extra\": {\n    \"private-composer-installer\": {\n      \"dotenv-path\": \".\",\n      \"dotenv-name\": \".env\"\n    }\n  }\n}\n```\n\n### dotenv-path\n\nDotenv file directory relative to the root package (where `composer.json` is located). By default dotenv files are expected to be in the root package folder or in any of the parent folders.\n\n### dotenv-name\n\nDotenv file name. Defaults to `.env`.\n\n## Dependencies\n\nThis package heavily depends on [vlucas/phpdotenv](https://github.com/vlucas/phpdotenv) to load environment variables \"automagically\". This may cause version conflicts if your project already depends on it. Refer to this table to set the version of `private-composer-installer` accordingly or consider upgrading.\n\n| `vlucas/phpdotenv` | `private-composer-installer` |\n| ------------------ | ---------------------------- |\n| `^4.1`, `^5.2`     | `^5.0`                       |\n| `^4.0`             | `^4.0`                       |\n| `^3.0`             | `^3.0`, `^2.0`               |\n| `^2.2`             | `^1.0`                       |\n\n## Development\n\nInstall Composer dependencies:\n\n```bash\ndocker-compose run --rm composer composer install\n```\n\nBefore pushing changes to the repository run tests and check coding standards using following command:\n\n```bash\ndocker-compose run --rm composer composer test\n```\n\n---\n\nThis is a project by [Fränz Friederes](https://fraenz.frieder.es/) and [contributors](https://github.com/ffraenz/private-composer-installer/graphs/contributors)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffraenz%2Fprivate-composer-installer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fffraenz%2Fprivate-composer-installer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fffraenz%2Fprivate-composer-installer/lists"}