Composer PHP packages
When you create a project, you often use a pre-set library already written in PHP. Private dependencies can help you download these external packages/libraries. This article will tell you how to serve private projects in the Composer dependencies in Buddy.
Authorization with SSH key
- Go to Variables, Keys & Assets and generate a new SSH key:
Image loading...
- Enter id_rsaas the name and click Add this variable to add the key:
Image loading...
Once done, you can use the public key to authorize in the repository.
Authorization with OAuth token GitHub
- Generate a personal access token in the GitHub settings. While adding, make sure to select the reposcope:
Image loading...
- In Buddy, go to Variables, Keys & Assets and add a new variable named GH_TOKEN. As the value, paste the generated GitHub token:
Image loading...
- Go to your PHP action and enter the following before composer install:
bashcomposer config github-oauth.github.com ${GH_TOKEN} composer install$$
Authorization with GitLab Token
- Generate a personal access token in the GitLab settings. Make sure the expiration date is extended enough:
Image loading...
- In Buddy, go to Variables, Keys & Assets and add a new variable named GL_TOKEN. As the value, paste the generated GitLab token:
Image loading...
- Go to your PHP action and enter the following command before composer install:
bashcomposer config gitlab-token.gitlab.com ${GL_TOKEN} composer install$$
Authorization with HTTP Basic Auth
- Go to Variables, Keys & Assets and add two variables with repository credentials (login/pass):
Image loading...
- Go to your PHP action and enter the following command before composer install:
bashcomposer config --global --auth http-basic.repo.example.org ${AUTH_USER} ${AUTH_PASS} composer install$$
Last modified on Jan 29, 2025