0

I am writing a package that is meant to be installed only on developer local machines. What can I do to make sure it appears next to other packages in require-dev like phpunit etc.

Also why would I even bother listing any dependencies in require-dev of my package since they will never be installed anyways in the target application??

My composer.json:

{
  "name": "alquesadilla/my-package-name",
  "description": "Some thing to help you in your local development.",
  "type": "library",
  "license": "MIT",
  "version": "1.0.0",
  "authors": [
    {
      "name": "Name",
      "email": "email@email.com",
      "homepage": "http://someurl.com"
    }
  ],
  "bin": ["bin/enforce"],
  "autoload": {
    "psr-4": {
      "alquesadilla\\MyClass\\": "src/"
    }
  },
  "require": {
    "squizlabs/php_codesniffer": "3.1.*",
    "exussum12/coverage-checker": "0.7.*"
  }
}
kratos
  • 2,465
  • 2
  • 27
  • 45

1 Answers1

2

What can I do to make sure it appears next to other packages in require-dev like phpunit etc.

You can't.

The only way you could would be by means of an installer script in the downstream composer.json, but that would mean that you would need a way to enforce this, and there's none that I am aware of.

For reference, see https://getcomposer.org/doc/articles/scripts.md#installer-events.

Also why would I even bother listing any dependencies in require-dev of my package since they will never be installed anyways in the target application??

See What is the difference between require and require-dev sections in composer.json?.

localheinz
  • 9,179
  • 2
  • 33
  • 44