A PHP library for generating RFC 2141 compliant uniform resource names (URN).

v0.2.0 2016-06-30 16:04 UTC

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads PHP Dependencies

A PHP library for generating RFC 2141 compliant uniform resource names (URN).

Requirements

This library has the following requirements:

  • PHP 5.6+

Installation

Install Composer in your project:

$ curl -s https://getcomposer.org/installer | php

Require the package via Composer:

$ php composer.phar require gravitymedia/urn

Usage

// 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"