This guide explains how to set up automatic publishing to Packagist using GitHub Actions.
- Packagist Account: Create an account at packagist.org
- GitHub Repository: Ensure this repository is public on GitHub
- Packagist API Token: Generate a token for automatic updates
- Go to packagist.org and create an account
- Click "Submit" and enter your repository URL:
https://github.com/GetStream/getstream-php - Packagist will automatically detect the package name from
composer.json
- Go to your Packagist profile: https://packagist.org/profile/
- Click "Show API Token" in the "API Token" section
- Copy the token (it looks like:
pkg_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
-
Go to your GitHub repository: https://github.com/GetStream/getstream-php
-
Click "Settings" → "Secrets and variables" → "Actions"
-
Click "New repository secret"
-
Add these secrets:
-
Name:
PACKAGIST_TOKENValue: Your Packagist API token from step 2 -
Name:
STREAM_API_KEYValue: Your Stream API key (for running tests) -
Name:
STREAM_API_SECRETValue: Your Stream API secret (for running tests)
-
- In your Packagist package page, go to "Settings"
- Enable "Update by GitHub Hook"
- Add the GitHub webhook URL:
https://packagist.org/api/github?username=YOUR_USERNAME&packageName=getstream/getstream-php
When a PR is merged into main or master, the release workflow will:
- Parse the PR title using Conventional Commit style.
- Required ticket format:
type: [FEEDS-1234] description - Keep
feat/fix/bugat the beginning of the title
- Required ticket format:
- Decide the bump type:
feat:=> minorfix:orbug:=> patchfeat!:/fix!:/BREAKING CHANGE=> major
- Update
composer.jsonandsrc/Constant.phpviascripts/release/bump_version.php - Commit version files, create a
vX.Y.Ztag, create a GitHub release - Trigger Packagist update
- Open a PR with a Conventional Commit style title, for example:
feat: [FEEDS-1350] add feed search endpointfix: [FEEDS-1402] handle nil reaction idfeat!: [FEEDS-1410] remove deprecated batch API
- Merge the PR into
mainormaster. - GitHub Actions will automatically perform release + Packagist update.
Titles like chore:, docs:, test: do not trigger a release.
If automatic publishing fails, you can manually trigger Packagist updates:
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_PACKAGIST_TOKEN" \
-d '{"repository":{"url":"https://github.com/GetStream/getstream-php"}}' \
https://packagist.org/api/update-package?username=YOUR_USERNAME- "Package not found": Ensure the package is submitted to Packagist first
- "Invalid token": Verify the Packagist token is correct
- "Tests failing": Check that all tests pass before creating a release
- "Version already exists": Use a new version number
- GitHub Actions: https://github.com/GetStream/getstream-php/actions
- Packagist Package: https://packagist.org/packages/getstream/getstream-php
- Test Installation:
composer require getstream/getstream-php
- Never commit API tokens to the repository
- Use GitHub Secrets for all sensitive data
- Regularly rotate your Packagist token
- Monitor the Actions logs for any security issues