PHP code example of xenolope / namespacery

1. Go to this page and download the library: Download xenolope/namespacery 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/ */

    

xenolope / namespacery example snippets


$resolver = new \Xenolope\Namespacery('Vendor\Package\Group\Class');

// Returns the value of the first namespace segment
$resolver->parseSegments()->getFirstSegment();

// Returns the value of the last namespace segment
$resolver->parseSegments()->getLastSegment();

// Returns the value of the segment at the given index, or an \OutOfBoundsException if the index doesn't exist
$resolver->parseSegments()->getSegment(1);

// Returns an array of all segments in the namespace
$resolver->parseSegments()->getSegments();