A PHP library for generating RFC 2141 compliant uniform resource names (URN).
This library has the following requirements:
- PHP 5.6+
Install Composer in your project:
$ curl -s https://getcomposer.org/installer | php
Require the package via Composer:
$ php composer.phar require gravitymedia/urn
// require autoloader
require 'vendor/autoload.php';
// import classes
use GravityMedia\Urn\Urn;
// create URN object from string
$urn = Urn::fromString('urn:example-namespace-id:just_an_example');
// dump namespace identifier
var_dump($urn->getNamespaceIdentifier()); // string(20) "example-namespace-id"
// dump namespace specific string
var_dump($urn->getNamespaceSpecificString()); // string(15) "just_an_example"