A PackageUrl library in pure Elixir.
The current implementation fully passes the test suites from the official purl-spec and from the javascript implementation. It also supports custom sanitization/validation as defined in https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst for the following packages:
alpm
bitbucket
cargo
cocoapods
composer
conan
conda
cran
deb
docker
gem
generic
github
golang
hackage
hex
maven
npm
nuget
oci
pub
pypi
swid
swift
If available in Hex, the package can be installed
by adding package_url
to your list of dependencies in mix.exs
:
def deps do
[
{:package_url, "~> 0.1.0"}
]
end
iex> purl = PackageUrl.new!("pkg:maven/org.apache.commons/io@1.3.4")
%PackageUrl{
name: "io",
namespace: "org.apache.commons",
qualifiers: nil,
scheme: "pkg",
subpath: nil,
type: "maven",
version: "1.3.4"
}
iex> PackageUrl.to_string!(purl)
"pkg:maven/org.apache.commons/io@1.3.4"
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/package_url.
PackageUrl is released under the MIT License - see the LICENSE file.