When creating a composer package, what "Package Type" should I choose
Asked Answered
A

1

26

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?

Alleviate answered 8/2, 2017 at 23:33 Comment(0)
A
33

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

Alleviate answered 8/2, 2017 at 23:33 Comment(1)
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 usefulBoccie

© 2022 - 2024 — McMap. All rights reserved.