renovate/docs/usage/php.md

71 lines
2.4 KiB
Markdown
Raw Normal View History

2019-01-13 12:01:00 +00:00
---
title: PHP Composer Support
description: PHP Composer support in Renovate
---
# Automated Dependency Updates for PHP Composer Dependencies
Renovate can upgrade dependencies in PHP's `composer.json` and `composer.lock` files.
2019-01-13 12:01:00 +00:00
## How It Works
1. Renovate searches in each repository for any `composer.json` files
1. Existing dependencies are extracted from the relevant sections of the JSON
1. Renovate resolves the dependency on Packagist (or elsewhere if configured), and filter for SemVer versions
1. A PR is created with `composer.json` and `composer.lock` updated in the same commit
1. If the source repository has either a "changelog" file or uses GitHub releases, then Release Notes for each version will be embedded in the generated PR
2019-01-13 12:01:00 +00:00
## Enabling
2019-08-27 11:11:25 +00:00
Either install the [Renovate App](https://github.com/apps/renovate) on GitHub, or check out [Renovate OSS](https://github.com/renovatebot/renovate) for self-hosted.
## Private packages
If you are using a [privately hosted Composer package](https://getcomposer.org/doc/articles/authentication-for-private-packages.md) you can pass the credentials via the [`hostRules`](https://docs.renovatebot.com/configuration-options/#hostrules) configuration.
```json
{
"hostRules": [
{
"matchHost": "some.vendor.com",
"hostType": "packagist",
"username": "<your-username>",
"password": "<your-password>"
},
{
"matchHost": "bearer-auth.for.vendor.com",
"hostType": "packagist",
"token": "abcdef0123456789"
}
]
}
```
This host rule is best added to the bot's `config.js` config so that it is not visible to users of the repository.
2022-05-25 13:23:28 +00:00
If you are using the hosted Mend Renovate App then you can encrypt it with Renovate's public key instead, so that only Renovate can decrypt it.
2021-10-04 15:57:18 +00:00
Go to [https://app.renovatebot.com/encrypt](https://app.renovatebot.com/encrypt), paste in the secret string you wish to encrypt, click _Encrypt_, then copy the encrypted result.
You may encrypt your `password` only, but you can encrypt your `username` as well.
```json
{
"hostRules": [
{
"matchHost": "some.vendor.com",
"hostType": "packagist",
"encrypted": {
2022-04-13 21:01:34 +00:00
"username": "<your-encrypted-username>",
"password": "<your-encrypted-password>"
}
},
{
"matchHost": "bearer-auth.for.vendor.com",
"hostType": "packagist",
"encrypted": {
"token": "<your-encrypted-token>"
}
}
]
}
```