PHP
Support for PHP projects using composer.json.
Table of contents
- Supported Files
- Registry
- Dependency Format
- Version Specification
- Special Cases
- Vulnerability Database
- Example composer.json
- Tooling Integration
- Troubleshooting
Supported Files
| File | Description |
|---|---|
composer.json |
Composer manifest |
Registry
Packagist - The PHP package repository
- Base URL:
https://repo.packagist.org - Rate limit: ~60 requests per minute
- Documentation: packagist.org
Dependency Format
Regular Dependencies
{
"require": {
"php": ">=8.1",
"laravel/framework": "^10.0",
"guzzlehttp/guzzle": "^7.0"
}
}
Development Dependencies
{
"require-dev": {
"phpunit/phpunit": "^10.0",
"phpstan/phpstan": "^1.10"
}
}
Version Specification
Composer uses semantic versioning:
| Syntax | Meaning |
|---|---|
1.0.0 |
Exactly 1.0.0 |
^1.0 |
>=1.0.0, <2.0.0 |
~1.0 |
>=1.0.0, <1.1.0 |
>=1.0 <2.0 |
Range |
1.0.* |
1.0.x |
* |
Any version |
dev-main |
Development branch |
Special Cases
Package Naming
Packagist uses vendor/package format:
{
"require": {
"symfony/console": "^6.0",
"monolog/monolog": "^3.0"
}
}
PHP Version Constraints
{
"require": {
"php": ">=8.1 <8.4"
}
}
PHP constraints show version compatibility info.
Extensions
{
"require": {
"ext-json": "*",
"ext-mbstring": "*"
}
}
Extension requirements show → Extension hint.
Development Versions
{
"require": {
"vendor/package": "dev-main"
}
}
Dev versions (dev-main, dev-master, x.x.x-dev) are filtered from latest version checks.
Abandoned Packages
Abandoned packages on Packagist show ⚠ Abandoned hint. The hover shows the suggested replacement if available.
Vulnerability Database
PHP vulnerabilities are sourced from:
- PHP Security Advisories Database
- GitHub Security Advisories
- Packagist security notices
Example composer.json
{
"name": "myorg/myproject",
"type": "project",
"require": {
"php": ">=8.1",
"laravel/framework": "^10.0", // ✓
"guzzlehttp/guzzle": "^7.0", // -> 7.8.0
"symfony/console": "^6.0" // ✓
},
"require-dev": {
"phpunit/phpunit": "^10.0", // -> 10.5.0
"phpstan/phpstan": "^1.10" // ✓
}
}
Tooling Integration
After updating composer.json with Dependi:
# Update lockfile and install
composer update
# Update specific package
composer update vendor/package
# Check for outdated packages
composer outdated
Troubleshooting
Package Not Found
- Verify vendor/package format
- Check if package exists on Packagist
- For private packages, configure repository in
composer.json
Version Constraints Too Restrictive
If no updates are shown but versions exist:
- Check your PHP version constraint
- Review package’s PHP requirements
- Consider relaxing version constraints
Private Packages
For private Packagist/Satis repositories:
- Configure repository in
composer.json - Set up authentication in
auth.json - Note: Dependi currently uses Packagist only
Abandoned Package Warning
If a package shows abandoned:
- Check the replacement suggestion on hover
- Plan migration to the replacement
- Review the original package’s README for migration guide