Uploading and Downloading a Composer Package on the Client
CodeArts Artifact can connect to local Composer clients. You may upload your private packages from your local Composer client to self-hosted repos and share them with others, who can download these Composer packages through their clients.
Composer Package
Composer is a dependency manager for the PHP programming language. It allows you to declare the libraries your project depends on and manage the installation of these dependencies. These dependencies are usually referred to as packages or composer packages.
Constraints
The repository password for a self-hosted repo is account-specific. If you are prompted for a password while using a different account, download the configuration file from the repository's Tutorial tab to obtain it.
Prerequisites
- You have installed the PHP and Composer clients.
- You have created a Composer repository.
- You have the Download/View permission on the current repository. For details about how to obtain this permission, see Configuring Repository Permissions.
Uploading a Composer Package from the Client
- Access self-hosted repos using your Huawei Cloud account.
- Select the target Composer repository on the self-hosted repo page.
- Click Tutorial on the right of the page.
- In the displayed dialog box, click Download Guide File to download the composer.json file.

- Obtain {username} and {password} from the downloaded file.
- Run the following command on your local client to upload the local Composer package to the target self-hosted repo.
curl -u {{user}}:{{password}} -X PUT https://{{url}}/{{vendor_name}}/{{project_name}}/{{version}}/{{vendor_name}}-{{project_name}}-{{version}}.zip;composer.version={{version}} -T {{localFile}}- user: {username} obtained in 5.
- password: {password} obtained in 5.
- url: repository address of the Composer repository.
- vendor_name: vendor name of the software package.
- project_name: project name of the software package.
- version: software package version.
- localFile: local path for storing the software package.
- Check the uploaded package in the Composer repository.
Downloading a Composer Package to the Client
- Access self-hosted repos using your Huawei Cloud account.
- Select the target Composer repository on the self-hosted repo page.
- Click Tutorial on the right of the page.
- In the displayed dialog box, select Follow the Guide file configuration.
- Replace the repository and credential configurations according to the configuration file.
- If there is no Composer project, initialize the project.
composer init
- Download the software package.
Add the software package dependency declaration.
composer require <vendor-name>/<project-name>:<version>
Download the installing dependency.
composer install
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot