folivoro/composer-dropin-installer

Copies a single file from a package into a target directory defined by installer-paths.

Maintainers

Package info

github.com/folivoro/dropin-installer-plugin

Type:composer-plugin

pkg:composer/folivoro/composer-dropin-installer

Statistics

Installs: 12

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v0.0.1 2026-05-18 17:49 UTC

This package is auto-updated.

Last update: 2026-05-18 17:49:39 UTC


README

Sloth Logo

Total Downloads Latest Stable Version License CI

Folivoro Composer-Dropin-Installer

A Composer plugin that copies a single file from any installed package into a target directory resolved from the root package's installer-paths configuration.

Why

Some packages need to place a single file at a specific location in the project — for example, a WordPress MU-plugin bootstrapper. The standard composer/installers approach installs an entire package directory. This plugin does one thing: copies a single declared file to the right place.

Installation

composer require folivoro/composer-dropin-installer

Usage

In any package that wants to install a dropin file, add to composer.json:

{
    "extra": {
        "dropin": {
            "file": "my-plugin.php",
            "target-type": "wordpress-muplugin",
            "target-dir": "my-plugin"
        }
    }
}

The root project must have installer-paths configured for the target type:

{
    "extra": {
        "installer-paths": {
            "public/extensions/components/{$name}/": [
                "type:wordpress-muplugin"
            ]
        }
    }
}

Given the above, my-plugin.php will be copied to:

public/extensions/components/my-plugin/my-plugin.php

Configuration

Key Required Description
file Filename to copy from the package root
target-type The installer-paths type to resolve the target directory
target-dir Subdirectory name within the resolved path. Defaults to the package name.

How it works

On pre-autoload-dump, the plugin iterates all installed packages and checks for extra.dropin configuration. For each match, it resolves the target directory from the root package's installer-paths and copies the file. On uninstall, the copied file is removed.

License

MIT