Add support for PHP Pear (#2775)

* Add support for PHP Pear and unify PECL with it

Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix tests

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* remove log statements

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

* fix struct comment

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>

---------

Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Laurent Goderre
2025-04-30 20:16:58 +00:00
committed by GitHub
co-authored by Alex Goodman
parent 78ef2cf53b
commit 529840bfc0
27 changed files with 3358 additions and 152 deletions
+7 -5
View File
@@ -36,7 +36,8 @@ const (
NpmPkg Type = "npm"
OpamPkg Type = "opam"
PhpComposerPkg Type = "php-composer"
PhpPeclPkg Type = "php-pecl"
PhpPeclPkg Type = "php-pecl" // Deprecated: will be removed in syft v2.0
PhpPearPkg Type = "php-pear"
PortagePkg Type = "portage"
PythonPkg Type = "python"
Rpkg Type = "R-package"
@@ -78,6 +79,7 @@ var AllPkgs = []Type{
OpamPkg,
PhpComposerPkg,
PhpPeclPkg,
PhpPearPkg,
PortagePkg,
PythonPkg,
Rpkg,
@@ -132,8 +134,8 @@ func (t Type) PackageURLType() string {
return packageurl.TypeGeneric
case PhpComposerPkg:
return packageurl.TypeComposer
case PhpPeclPkg:
return "pecl"
case PhpPearPkg, PhpPeclPkg:
return "pear"
case PythonPkg:
return packageurl.TypePyPi
case PortagePkg:
@@ -192,8 +194,8 @@ func TypeByName(name string) Type {
return DebPkg
case packageurl.TypeComposer:
return PhpComposerPkg
case "pecl":
return PhpPeclPkg
case "pear", "pecl":
return PhpPearPkg
case packageurl.TypeGolang:
return GoModulePkg
case packageurl.TypeGem: