PHP code example of gravitymedia / urn

1. Go to this page and download the library: Download gravitymedia/urn library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gravitymedia / urn example snippets


// quire '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"
bash
$ php composer.phar