Composer Azure plugin is an attempt to use Composer with Azure DevOps artifacts, via universal packages.
Composer Azure Plugin requires Composer 2 and PHP8.1 or newer. It should be installed globally.
$ composer global require mikedevresse/composer-azure-plugin
You have to be logged in via the Azure command line interface .
This plugin has two components. Publishing a composer package to azure and pulling the dependency.
In the package you want to publish you have to add an azure-publish-registry
config to the extra
block.
{
...
"extra": {
"azure-publish-registry": {
"organization": "dev.azure.com/<my-organization>",
"project": "<my-project-name>",
"feed": "<my-feed-name>"
}
}
}
This plugin adds a new composer command to easily publish the package. Just run composer azure:publish
and it will
remove all ignore files (e.g. the vendor folder) and publish the code to azure artifacts.
To use a published package add an azure-repositories
config to the extra
block. There you define which packages are
required for the current project. In the required
block you then define the requirements as usual. The only downsite
is, that you can't use constraints and set a specific version.
{
"require": {
"vendor-name/my-package": "1.0.0"
},
"extra": {
"azure-repositories": [
{
"organization": "dev.azure.com/<my-organization>",
"project": "<my-project-name>",
"feed": "<my-feed-name>",
"symlink": false,
"packages": [
"vendor-name/my-package"
]
}
]
}
}