Artifactory: Resolve from composer local repository
Artifactory supports PHP Composer repositories
The official documentation provides steps for deploying the Composer package , but is not particularly detailed.
We can see that only the version field is specified in the documentation:
Problems and resolutions
You may encounter that after uploading an artifact, you cannot get the artifact’s index from the local repository, which is usually due to some missing parameters in composer.json;
Make sure the name and version fields are in your composer.json
Practice
Refer to the following procedure to fully deploy a composer package, you will be able to see the uploaded artifact information in the index;
1. Make test project
$ mkdir -p composer-example
$ touch composer.json
$ vim composer.json
{
"name": "jfrog/testphp", //your-vendor-name/package-name
"version": "1.0.21", //package-version
"type": "project",
"require": { //dependencies
"doctrine/cache": "2.2.0"
}
}
2. Create composer repositories and Set Up follow “Set Me Up”
3. Run composer install
$ composer --version Composer version 2.5.8 $ composer install … 1 package you are using is looking for funding.
4. Deploy to Artifactory
$ ls composer.json composer.lock vendor $ zip -r a22.zip * $ curl -uadmin:xx "http://192.168.xx.xx:8081/artifactory/php-local/jfrog/test/" -T a22.zip
- jfrog/test is the folder path.
- a22.zip is the file name
5. Check index from composer local repository (php-local)