composer-phpkirby

Override composer package type upon installation


Is there a way to override a composer package type upon installation? I want to install a composer package which uses a custom type. This type leads into a custom installation path.

What I try to achieve is to ignore the custom installation path and put all the sources under vendor. Is this possible?

The custom type is handled by a composer plugin: https://packagist.org/packages/getkirby/composer-installer


Solution

  • You cannot "override" a package type without actually forking the package.

    And most of the time, wouldn't actually do anything, since the type is only used by custom installer logic. So unless one is actually using a composer plugin with installer logic... the type field does not accomplish anything.

    Since you now mention that you are attempting to do this for a Kirby Plugin...

    Kirby uses its own custom installer: composer-installer.

    In the docs is mentioned how to choose a different installation directory for plugins. Following these instructions, to actually install your plugins in vendor it would in theory as simple as doing:

    {
      "require": {
        "getkirby/cms": "^3.0",
        "superwoman/superplugin": "^1.0"
      },
      "extra": {
        "kirby-plugin-path": "vendor" // change this to your custom path
      }
    }
    

    Sadly, it does not seem you can do this just for one specific plugin, as you would be able to do if Kirby just used composer/installers.