Search code examples
phpdependenciescomposer-phpdependency-management

How to figure out what will be inside the "require" or "require-dev" portion of a composer file?


I am writing a composer file. There are some dependencies. I am curious how people find out the names of the dependencies. For example one of the dependencies is ext-imagick. I know this because one the dependency of my project is php-imagick and I asked in SO and someone answered that it should be ext-imagick.

How did he figure it out? Is there some kind of library?


Solution

  • That's right, PHP imagick extension requirement is defined as ext-imagick.

    Composer manual covers ext syntax.

    You can check extension names against your own PHP installation or PHP manual. Notice that extension page urls contain their identifiers, e.g. http://php.net/manual/en/ref.pdo-mysql.php should be referred in Composer as ext-pdo_mysql (hyphen in identifier is replaced with underscore).