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
- Generate a new pair of SSH keys in the terminal (make sure they’re not secured by a passphrase):
bash ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Add the private key to Environment variables in Buddy and enter
id_rsa
as the name.Authorize the public key in the repository.
Authorization with HTTP Basic Auth
- Add the environment variables with login and password to the repository:
Enter the following command before
composer install
:composer config --global --auth http-basic.github.com ${AUTH_USER} ${AUTH_PASS} composer install
$$
If the host is different from GitHub, just change the first element to
http-basic.gitlab.com
/ http-basic.bitbucket.org
, etc.
Authorization with OAuth token GitHub
- Generate a token in GitHub settings. While adding, select the scope
repo
:Selecting scope of permissions in GitHub
- Add an enviroment variable named
GH_TOKEN
and paste the value from the previous step: - Enter the following command before
composer install
:
composer config github-oauth.github.com ${GH_TOKEN} composer install
$$
Authorization with GitLab Token
- Generate a token in GitLab settings. Make sure the expiration date is extended enough:
Selecting scope of permissions in GitLab
- Add an environment variable named
GL_TOKEN
and paste the value from the previous step: Enter the following command before
composer install
:composer config gitlab-token.gitlab.com ${GL_TOKEN} composer install
$$
Last modified on May 9, 2022