Repository navigation
Add Composer scanner for PHP projects - #38
Merged
Merged
Conversation
Restores PHP support that was previously covered by the standalone
eacg-gmbh/ecs-composer Composer plugin, this time as a regular ts-scan
package manager scanner.
The scanner detects a project by its composer.json and resolves the
dependency graph from composer.lock, so a committed lockfile needs
neither a Composer installation nor network access. Without a lockfile
ts-scan runs "composer update --no-install" and falls back to the
requirements declared in composer.json if that is not possible.
Carried over from ecs-composer:
* the component key "composer:vendor/name", so existing TrustSource
components keep matching
* the platform package metadata (php, ext-*, composer-*) including
their well-known licenses
Dependencies are exported with spec conformant purls of the form
pkg:composer/vendor/name@version. The module id deliberately carries no
version, so module level mutes survive version bumps.
New options:
* --composer:includeDevDependencies
* --composer:includePlatformPackages
* --composer:enableMetadataRetrieval
Includes an example project with a committed lockfile and regression
tests covering transitive requirements, provide/replace resolution,
abandoned packages, cyclic requirements and the lockfile fallbacks.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Bandit found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
This was referenced Sep 22, 2026
Merged
Contributor
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: gr-markin <2349286+gr-markin@users.noreply.github.com>
Co-authored-by: gr-markin <2349286+gr-markin@users.noreply.github.com>
Co-authored-by: gr-markin <2349286+gr-markin@users.noreply.github.com>
Co-authored-by: gr-markin <2349286+gr-markin@users.noreply.github.com>
Co-authored-by: gr-markin <2349286+gr-markin@users.noreply.github.com>
Co-authored-by: gr-markin <2349286+gr-markin@users.noreply.github.com>
Co-authored-by: gr-markin <2349286+gr-markin@users.noreply.github.com>
Co-authored-by: gr-markin <2349286+gr-markin@users.noreply.github.com>
Contributor
gr-markin
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
PHP support used to live in the standalone Composer plugin eacg-gmbh/ecs-composer, which posted scans directly to the ECS API. Since ts-scan became the entry point for all ecosystems, that plugin is no longer usable. This brings PHP back as a regular ts-scan scanner, so Composer projects flow through the same
scan→check/analyse/uploadpaths as every other ecosystem.What
A new
ComposerScannerinsrc/ts_scan/pm/composer.py:composer.jsonand resolves the dependency graph fromcomposer.lock— a committed lockfile needs neither a Composer installation nor network accesscomposer update --no-install --no-scripts; if that fails or Composer is missing, falls back to the requirements declared incomposer.json(reported without resolved versions) instead of aborting the scanprovide/replace, so virtual requirements such aspsr/log-implementationattach to the package that satisfies themdist.shasum,source.reference, licenses, homepage and description, and warns aboutabandonedpackagesvendor/<vendor>/<package>aspackage_files, so the in-depth analysis picks up installed sourcesCarried over from ecs-composer
composer:vendor/name, so existing TrustSource components keep matchingPlatformPackage.php—php/ext-*→ PHP-3.01,composer-plugin-api/composer-runtime-api→ MIT, including their homepage and repository URLsIdentity
Dependencies export as spec conformant purls, e.g.
pkg:composer/monolog/monolog@3.5.0. The module id deliberately carries no version (composer:acme/inventory-app), so module level mutes and exemptions survive version bumps.Options
--composer:includeDevDependenciesrequire-devandpackages-dev--composer:includePlatformPackagesphp,ext-*,lib-*,composer-*with their licenses--composer:enableMetadataRetrievalplus the inherited
--composer:ignore,--composer:executableand--composer:forward.Tests
examples/composer/ships a committed lockfile covering transitive requirements,provide, an abandoned package, dev dependencies and platform requirements.tests/test_composer.pyadds 12 regression tests; the full suite is green (52 passed).Limitations
>=8.1), not a resolved runtime version — the lockfile does not contain one, and the scanning machine's PHP version would be misleading.pkg:composer/phpis a pragmatic purl; purl has no PHP runtime type. It intentionally does not match anything on Packagist.Note for reviewers
feature/cocoapods-scanandfeature/swift-package-manager-scantouch the same three lines (scanner registry, README ecosystem list, CHANGELOG) and will need a rebase after this lands.🤖 Generated with Claude Code