package-url / packageurl-php
Builder and parser based on the package URL (purl) specification.
Fund package maintenance!
jkowalleck
Installs: 901 265
Dependents: 2
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 4
Open Issues: 9
Requires
- php: ^7.3 || ^8.0
Requires (Dev)
- ext-json: *
- phpunit/phpunit: 9.6.16
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-12-07 12:22:26 UTC
README
Package URL (purl) for PHP
A parser and builder based on package url spec, implemented in PHP.
License: MIT
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.