All Projects → ffraenz → Private Composer Installer

ffraenz / Private Composer Installer

Licence: mit
Composer install helper outsourcing sensitive keys from the package URL into environment variables

Projects that are alternatives of or similar to Private Composer Installer

Acf Pro Installer
A composer install helper for Advanced Custom Fields PRO
Stars: ✭ 265 (+57.74%)
Mutual labels:  wordpress, acf, composer, packagist, composer-plugin
composer-localdev-plugin
Composer Plugin for local development
Stars: ✭ 31 (-81.55%)
Mutual labels:  packagist, composer, composer-plugin
composer-diff
Compares composer.lock changes and generates Markdown report so you can use it in PR description.
Stars: ✭ 51 (-69.64%)
Mutual labels:  packagist, composer, composer-plugin
Beetbox
Pre-provisioned L*MP stack
Stars: ✭ 94 (-44.05%)
Mutual labels:  wordpress, composer, composer-plugin
composer-velocita
Velocita - Composer plugin for transparent caching
Stars: ✭ 26 (-84.52%)
Mutual labels:  packagist, composer, composer-plugin
Acf Builder
An Advanced Custom Field Configuration Builder
Stars: ✭ 492 (+192.86%)
Mutual labels:  wordpress, acf, composer
Awesome Composer
😎 A curated awesome list for Composer, Packagist, Satis, Plugins, Scripts, Composer related resources, tutorials.
Stars: ✭ 738 (+339.29%)
Mutual labels:  composer, packagist, composer-plugin
Satis Server
🐳 Private, self-hosted Composer/Satis repository with unlimited private and open-source packages and support for Git, Mercurial, and Subversion. HTTP API, HTTPs support, webhook handler, scheduled builds, Slack and HipChat integration.
Stars: ✭ 96 (-42.86%)
Mutual labels:  composer, packagist
Fewbricks
Write code to create ACF field groups, fields and re-usable modules.
Stars: ✭ 100 (-40.48%)
Mutual labels:  wordpress, acf
Plate
Plate: a super stripped-down WordPress starter theme for developers.
Stars: ✭ 110 (-34.52%)
Mutual labels:  wordpress, acf
Packeton
📦 Private, self-hosted Packagist/Composer/Satis repository with unlimited private repos.
Stars: ✭ 115 (-31.55%)
Mutual labels:  composer, packagist
Hprose Php
Hprose is a cross-language RPC. This project is Hprose 3.0 for PHP
Stars: ✭ 1,952 (+1061.9%)
Mutual labels:  composer, packagist
Acf Star Rating Field
A simple star rating field for ACF.
Stars: ✭ 94 (-44.05%)
Mutual labels:  wordpress, acf
Wordplate
WordPlate is a wrapper around WordPress. It's like building any other WordPress website with themes and plugins. Just with sprinkles on top.
Stars: ✭ 1,594 (+848.81%)
Mutual labels:  wordpress, composer
Wordpress
Automatically updated WordPress composer package
Stars: ✭ 94 (-44.05%)
Mutual labels:  wordpress, composer
Acf Codifier
A wrapper class to help write more readable ACF field declarations.
Stars: ✭ 114 (-32.14%)
Mutual labels:  wordpress, acf
React Wp Rest
A boilerplate for pairing the WP Rest API with a server-rendered React app
Stars: ✭ 167 (-0.6%)
Mutual labels:  wordpress, acf
Composer Cleaner
Victor The Cleaner: removes unnecessary files from vendor directory
Stars: ✭ 114 (-32.14%)
Mutual labels:  composer, composer-plugin
Security Advisories
A database of PHP security advisories
Stars: ✭ 1,740 (+935.71%)
Mutual labels:  composer, packagist
Acf Tools
Advanced Custom Fields code made simple! 🙌
Stars: ✭ 121 (-27.98%)
Mutual labels:  wordpress, acf

private-composer-installer

Packagist version MIT license Build Status Coverage Status Packagist downloads

This is a Composer 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 or Basic HTTP Auth because the source of a package is not in your control. This repository is inspired by acf-pro-installer.

Quick overview

  • This plugin is compatible with both Composer 2.x (latest) and 1.x.
  • 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.
  • 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.
  • 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.
  • If an environment variable can't be resolved a MissingEnvException gets thrown.
  • Package dist URLs with no {%VARIABLE} formatted placeholders get ignored by this plugin.

Examples

Arbitrary private package

Add the desired private package to the repositories field inside composer.json. Find more about Composer repositories in the Composer documentation. Replace the version as well as other sensitive tokens by {%VARIABLE} placeholders.

{
  "type": "package",
  "package": {
    "name": "package-name/package-name",
    "version": "1.0.0",
    "dist": {
      "type": "zip",
      "url": "https://example.com/package-name.zip?key={%PACKAGE_KEY}&version={%VERSION}"
    },
    "require": {
      "ffraenz/private-composer-installer": "^5.0"
    }
  }
}

Provide the private package dist URL inside the .env file:

PACKAGE_KEY=pleasedontusethiskey

Let Composer require the private package:

composer require "package-name/package-name:*"

WordPress plugins

WordPress 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 field inside composer.json and set the desired ACF Pro version.

{
  "type": "package",
  "package": {
    "name": "advanced-custom-fields/advanced-custom-fields-pro",
    "version": "1.2.3",
    "type": "wordpress-plugin",
    "dist": {
      "type": "zip",
      "url": "https://connect.advancedcustomfields.com/index.php?a=download&p=pro&k={%PLUGIN_ACF_KEY}&t={%VERSION}"
    },
    "require": {
      "composer/installers": "^1.4",
      "ffraenz/private-composer-installer": "^5.0"
    }
  }
}

Provide the ACF Pro key inside the .env file. To get this key, login to your ACF account and scroll down to 'Licenses & Downloads'.

PLUGIN_ACF_KEY=pleasedontusethiskey

Let Composer require ACF Pro:

composer require "advanced-custom-fields/advanced-custom-fields-pro:*"

Configuration

The configuration options listed below may be added to the root configuration in composer.json like so:

{
  "name": "...",
  "description": "...",
  "require": {
  },
  "extra": {
    "private-composer-installer": {
      "dotenv-path": ".",
      "dotenv-name": ".env"
    }
  }
}

dotenv-path

Dotenv 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.

dotenv-name

Dotenv file name. Defaults to .env.

Dependencies

This package heavily depends on 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.

vlucas/phpdotenv private-composer-installer
^4.1, ^5.2 ^5.0
^4.0 ^4.0
^3.0 ^3.0, ^2.0
^2.2 ^1.0

Development

Install Composer dependencies:

docker-compose run --rm composer composer install

Before pushing changes to the repository run tests and check coding standards using following command:

docker-compose run --rm composer composer test

This is a project by Fränz Friederes and contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].