dpp/composer-plugin

Composer plugin for integration with the Drupal Project Platform

Installs: 31 458

Dependents: 0

Suggesters: 0

Security: 0

Type:composer-plugin

1.0.0-beta13 2024-04-16 14:47 UTC

README

This plugin adds the ability to use the DPP package manager.

Installation

The plugin needs to be installed globally, because it needs to be present before composer resolves the dependencies.

composer global config repositories.dpp-composer-plugin vcs https://gitlab.burdaverlag.dev/thunder/dpp-composer-plugin.git
composer global require dpp/composer-plugin

Configuration

Onboard existing project via command

You can run the custom onboard command to configure your existing project.

composer dpp-onboard

It automatically updates your composer.json so your project is set up for DPP and finally performs composer update to make sure all dependencies are supported.

Options

The command lets you set your own DPP base project git url

composer dpp-onboard --dpp-base-project-git-url git@gitlab.burdaverlag.dev:dpp/DPP-Base-Project.git

and your preferred DPP version constraint

composer dpp-onboard --dpp-version ^2.0

Manually configure your DPP project

Add the git url of your DPP base project to your composer.json extra section.

"extra": {
    "dpp-base-project-git-url": "git@gitlab.burdaverlag.dev:dpp/DPP-Base-Project.git"
},

Or set the environment variable

COMPOSER_DPP_BASE_PROJECT_GIT_URL="git@gitlab.burdaverlag.dev:dpp/DPP-Base-Project.git"

Also it's recommended to disable the packagist.org repo.

"repositories": [
    {
        "packagist.org": false
    }
]

Usage

You can now set the dpp version constraint in your composer.json.

  "require": {
    "dpp/version": "^1.0.0"
  },

All your other required packages will be resolved by the DPP package manager.

Dev Mode

To create a composer.dev.json with access to all packagist.org packages run:

composer dpp-create-dev-json

To use the composer.dev.json file run composer commands like

COMPOSER=./composer.json.dev composer <command>

Development

Create a new directory and add a composer.json file with the following content:

{
  "name": "dpp/dpp-project",
  "type": "project",
  "repositories": {
    "dpp/composer-plugin": {
      "type": "path",
      "url": "../plugin"
    }
  },
  "require": {
    "dpp/composer-plugin": "^1",
    "cweagans/composer-patches": "*"
  },
  "extra": {
    "enable-patching": true,
    "dpp-base-project-git-url": "git@gitlab.burdaverlag.dev:dpp/DPP-Base-Project.git"
  },
  "config": {
    "allow-plugins": {
      "dpp/composer-plugin": true
    }
  }
}

Change the url in the repositories section to the path to the plugin directory.

Then run composer install to install the plugin.

After that, you can run composer require dpp/version to test the plugin.