25

I'm creating my first PHP Composer package (following these instructions). I've run

$ composer init

and am filling in the details, it is now asking me for

Package Type (e.g. library, project, metapackage, composer-plugin) []:

I assume this is just a human-decipherable label for categorising the different packages?

I wondered if there is a definition of package types somewhere?

kris
  • 11,868
  • 9
  • 88
  • 110

1 Answers1

31

I found this as posting the question :

Composer Package Types

Out of the box, Composer supports four types:

  • library: This is the default. It will simply copy the files to /vendor.

  • project: This denotes a project rather than a library. For example application shells like the Symfony standard edition, CMSs like the SilverStripe installer or full fledged applications distributed as packages.

  • metapackage: An empty package that contains requirements and will trigger their installation, but contains no files and will not write anything to the filesystem.

  • composer-plugin: A package of type composer-plugin may provide an installer for other packages that have a custom type. Only use a custom type if you need custom logic during installation.

Package types are used for custom installation logic. If you have a package that needs some special logic, you can define a custom type. This could be a symfony-bundle, a wordpress-plugin or a typo3-cms-extension. These types will all be specific to certain projects, and they will need to provide an installer capable of installing packages of that type.

Source : https://getcomposer.org/doc/04-schema.md

kris
  • 11,868
  • 9
  • 88
  • 110
  • Just remembering that `composer-plugin` type are installed first, so if you plan to have a package of composer patches for the third-party packages you use, it becomes pretty useful – Code Slicer May 10 '22 at 13:43