定制 package-url/packageurl-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

package-url/packageurl-php

最新稳定版本:1.1.2

Composer 安装命令:

composer require package-url/packageurl-php

包简介

Builder and parser based on the package URL (purl) specification.

README 文档

README

shield_gh-workflow-test shield_packagist-version shield_license

A parser and builder based on package url spec, implemented in PHP.

License: MIT

Note

PackageURL (PURL) is currently undergoing a process of review and standardization, leading to updates in the specification.
As a result, this library may no longer comply with the latest PURL standards. It will not receive further updates until the standardization process is complete and a stable version of the specification is released.

Install

composer require package-url/packageurl-php

Usage

see also the examples.

<?php

use PackageUrl\PackageUrl;

$purl = (new PackageUrl('composer', 'console'))
    ->setNamespace('symfony')
    ->setVersion('6.3.8')
    ->setQualifiers([
        PackageUrl::QUALIFIER_VCS_URL => 'git+https://github.com/symfony/console.git@v6.3.8',
    ]);

$purlString = $purl->toString();

// string(96) "pkg:composer/symfony/console@6.3.8?vcs_url=git%2Bhttps://github.com/symfony/console.git%40v6.3.8"
var_dump($purlString);

// string(96) "pkg:composer/symfony/console@6.3.8?vcs_url=git%2Bhttps://github.com/symfony/console.git%40v6.3.8"
var_dump((string) $purl);

$purl2 = PackageUrl::fromString($purlString);
// bool(true)
var_dump($purl == $purl2);

Contributing

Feel free to open pull requests.
See the contribution docs for details.

统计信息

  • 总下载量: 1.56M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 2
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04