Knowledge

How to deal with private depedencies in composer

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.

Authorization with SSH key

  1. Generate a new pair of SSH keys (make sure they're not secured by a passphrase).
  2. Add the private key to Enviroment variables in Buddy and enter id_rsa as the name.
  3. Authorize the public key in the repository.
GIF
GIF

Authorization with HTTP Basic Auth

  1. Add the enviroment variables with login and password to the repository

    GIF
    GIF
  2. Before triggering composer install, execute the command:

    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.

SCREEN

Authorization with OAuth GitHub token

  1. Generate the token in the GitHub settings. While adding, select the scope repo:

    SCREEN

  2. Add an enviroment variable named GH_TOKEN and add the value copied in the previous step:

    GIF
    GIF
  3. Before triggering composer install, execute the command

    composer config github-oauth.github.com ${GH_TOKEN} 
    

Authorization with GitLab token

  1. Generate the token in the GitLab settings. Make sure that the expire date is extended enough.

    SCREEN

  2. Add an enviroment variables named GL_TOKEN and the value copied in the previous step:

    GIF
    GIF
  3. Before triggering composer, execute the command:

    composer config gitlab-token.gitlab.com ${GL_TOKEN}     
    

Join our development automation movement!

Download On-Premises Installation