JetBrains Space Help

Publish Composer Packages

Unlike other repositoriy types, there are no tools that let you publish packages to a Composer repository directly. Instead, a Composer repositoriy gets packages from a VCS repository. This could be a:

Alternatively, you can upload packages as .zip files.

How to update Composer packages

Typically, when you push a change to the Git repository with the package source code, a Composer repository automatically updates the corresponding package. If the change was made in a new branch, a new package version will be created.

The package versioning works with the help of Git tags: You should mark a corresponding commit with a tag and push the commit including the tag to the Git repository. The Composer repository will create a new package version matching the tag.

Publishing Composer packages from a Space Git repository

  1. Make sure your PHP library is prepared for distribution – your PHP project has a valid composer.json file. The project is stored in a Space Git repository.

  2. In Space, open the repository page and click Submit Composer Packages.

  3. Choose Space Repository.

  4. Choose the project and the Git repository that will be the package source.

  5. In Branch specification, specify filters for branches and tags. Each filter must start with a + character. For example, +:refs/heads/*.

    The Composer repository will watch for branches and tags that match the filters:

    • If a user pushes a commit to a new branch that matches the filter (or the commit is marked with a new tag that mathes the filter), the Composer repository will create a new package version.

    • If a user pushes a commit to an existing branch that matches the filter (or the commit is marked with an existing tag), the Composer repository will update the existing package (Immutable package versions must be disabled for the repository).

  6. Click Create. Space will connect to the Git repository and get package data.

Publishing Composer packages from an external Git repository

  1. Make sure your PHP library is prepared for distribution – your PHP project has a valid composer.json file. The project is stored in a Git repository.

  2. In Space, open the repository page and click Submit Composer Packages.

  3. Choose External Mirror.

  4. In Repository name, specify a name for the remote repository (this name will be shown in the list of Composer repository connections).

  5. In Remote repository URL, specify the URL of the external Git repository.

  6. Choose how the Composer repository should get updates from the external Git repository:

    • Check remote repository periodically: the Composer repository will sync with the Git repository approximately once an hour. Actual update frequency may vary as it depends on server load.

    • Check remote repository on fetch: the Composer repository will sync with the Git repository every time someone runs git fetch for a Git repository mirror.

  7. In Git refspec, specify filters for branches and tags. Each filter must start with a + character. For example, +:refs/heads/*.

    The Composer repository will watch for branches and tags that match the filters:

    • If a user pushes a commit to a new branch that matches the filter (or the commit is marked with a new tag that mathes the filter), the Composer repository will create a new package version.

    • If a user pushes a commit to an existing branch that matches the filter (or the commit is marked with an existing tag), the Composer repository will update the existing package (Immutable package versions must be disabled for the repository).

  8. In Authentication, specify the credentials required to access the remote repository. Depending on remote repository access rules, you may need to provide either an SSH key or your username/password. Choose Anonymous if no credentials are required.

  9. Click Create. Space will connect to the Git repository and get package data.

    Note that this not only creates connection to the Git repository, but also creates a Git repo mirror in Space. This mirror is added to the list of project Repositories.

Publishing Composer packages from a GitHub repository

  1. Make sure your PHP library is prepared for distribution – your PHP project has a valid composer.json file. The project is stored in a GitHub repository.

  2. In Space, open the repository page and click Submit Composer Packages.

  3. Choose GitHub Mirror.

  4. In Repository name, specify a name for the GitHub repository (this name will be shown in the list of Composer repository connections).

  5. In GitHub repository URL, specify the repository URL.

  6. Choose how the Composer repository should get updates from the GitHub repository:

    • Check remote repository periodically: the Composer repository will sync with the Git repository approximately once an hour. Actual update frequency may vary as it depends on server load.

    • Check remote repository on fetch: the Composer repository will sync with the Git repository every time someone runs git fetch for a GitHub repository mirror.

  7. In Git refspec, specify filters for branches and tags. Each filter must start with a + character. For example, +:refs/heads/*.

    The Composer repository will watch for branches and tags that match the filters:

    • If a user pushes a commit to a new branch that matches the filter (or the commit is marked with a new tag that mathes the filter), the Composer repository will create a new package version.

    • If a user pushes a commit to an existing branch that matches the filter (or the commit is marked with an existing tag), the Composer repository will update the existing package (Immutable package versions must be disabled for the repository).

  8. In Authentication, specify the credentials required to access the remote GitHub repository. Depending on your GitHub repository access rules, You can provide either your GitHub tocken or your username/password.

  9. Click Create. Space will connect to the Git repository and get package data.

    Note that this not only creates connection to the GitHub repository, but also creates a GitHub repo mirror in Space. This mirror is added to the list of project Repositories.

Uploading a Composer package as a .zip file

  1. In Space, open the repository page and click Submit Composer Packages.

  2. Choose Upload Files and specify the path to the .zip file with the package on your local machine.

Last modified: 27 May 2022