Skip to content

Commit a1509dc

Browse files
committed
docs: Add Packagist integration details to README
- Introduced a new section on Packagist Integration, explaining how Composer Update Helper fetches package information. - Described the two-tier approach for fetching package data: direct Packagist API calls and fallback to `composer show`. - Provided guidance on improving Packagist access through mirrors and private repositories. - Included performance considerations and tips for optimal usage. This update enhances the documentation to better inform users about dependency management and configuration options.
1 parent 2bd1814 commit a1509dc

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,70 @@ For detailed configuration options including language settings, dependency check
194194

195195
For framework support details, see [Framework Support](docs/FRAMEWORKS.md).
196196

197+
## Packagist Integration
198+
199+
Composer Update Helper fetches package information from Packagist to analyze dependencies and find compatible versions. Here's how it works:
200+
201+
### How It Works
202+
203+
The tool uses a two-tier approach for fetching package information:
204+
205+
1. **Primary Method**: Direct Packagist API calls (`https://packagist.org/packages/{package}.json`)
206+
- Fast and efficient for most use cases
207+
- Used for: package requirements, versions, abandoned status, maintainer info, alternative package search
208+
209+
2. **Fallback Method**: `composer show` command
210+
- Automatically used when Packagist API is unavailable or returns incomplete data
211+
- **Respects your project's repository configuration** in `composer.json`
212+
- Supports mirrors, private repositories, and custom repository setups
213+
214+
### Improving Packagist Access
215+
216+
#### Using Packagist Mirrors
217+
218+
If you're experiencing slow API responses or rate limiting, you can configure a Packagist mirror in your `composer.json`:
219+
220+
```json
221+
{
222+
"repositories": [
223+
{
224+
"type": "composer",
225+
"url": "https://mirror.packagist.com",
226+
"only": ["packagist"]
227+
}
228+
]
229+
}
230+
```
231+
232+
The fallback method (`composer show`) will automatically use your configured mirror.
233+
234+
#### Using Private Repositories
235+
236+
For private packages or internal repositories, simply configure them in your `composer.json`:
237+
238+
```json
239+
{
240+
"repositories": [
241+
{
242+
"type": "vcs",
243+
"url": "https://github.com/your-org/private-package"
244+
}
245+
]
246+
}
247+
```
248+
249+
When the Packagist API doesn't have information about these packages, the tool automatically falls back to `composer show`, which respects your repository configuration.
250+
251+
#### Performance Considerations
252+
253+
- **API Rate Limiting**: Packagist doesn't enforce strict rate limits, but excessive requests may be throttled. The tool includes proper user-agent headers and reasonable timeouts (5 seconds).
254+
255+
- **Offline Mode**: If you're working offline or behind a firewall, the tool will fall back to `composer show`, which uses Composer's local cache when available.
256+
257+
- **Caching**: Composer caches package metadata automatically. Running `composer update` periodically ensures your cache is fresh, improving fallback performance.
258+
259+
> 💡 **Tip**: If you're using a VPN or behind a corporate firewall, configuring a Packagist mirror or ensuring `composer show` works will provide the best experience.
260+
197261
## Requirements
198262

199263
- PHP >= 7.4

0 commit comments

Comments
 (0)