Composer custom install location for an external project

So, I’m starting a new site, and on listening to recent podcasts, it was hinted that the future of Drupal will be using Composer a lot more often, so I’m trying to re-start my dev environment using that. Note this is not pertaining to a production site, so permissions are not set appropriately right now.

I had set up my composer.json as recommended on the handbook pages, but now an issue arises when I try to use a third party library on my website. In this case, it’s a non-issue directly (why this isn’t in the project’s issue queue), but I’d rather keep my code in a tidy fashion in for the future.

Specifics, I’m having the whole Drupal in one composer project, then the individual sites in their own, using the multisite feature of Drupal for multiple projects. I have the sites.php done already, so that’s not an issue here.

Here is what my sites’ specific directory looks like, ignoring the .gitignore and the .git folders:

vendor/
–> everything not included below
libraries/
–> notably empty
modules/
—> various modules I’ve installed
themes/
–> various themes I’ve installed
files/
private/
settings.php
services.php
composer.json
autoload.php

The specific library I’m working with is php-markdown on behalf of the markdown module. Here’s the relevant bits from my composer.json file:

...
    "minimum-stability": "dev",
    "prefer-stable": true,
    "extra": {
        "installer-paths": {
            "libraries/{$name}": [
                "type:drupal-library",
                "michelf/php-markdown"
            ],
            "modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "themes/contrib/{$name}": [
                "type:drupal-theme"
            ]
        }
    },
...
    "require": {
        "oomphinc/composer-installers-extender": "^1.1",
...
        "composer/installers": "^1.2",
        "drupal/composer_security_checker": "^1.0",
        "michelf/php-markdown": "^1.7"
    }
...

And the php-markdown seems to always go to vendors/michelf/php-markdown instead of libraries/php-markdown and I can’t determine a resolution that I could do on my end.


Source: https://www.drupal.org/taxonomy/term/22/feed