xenolope/namespacery

A library to help parse namespaces

Installs: 24

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/xenolope/namespacery

v0.6 2014-10-26 13:52 UTC

This package is auto-updated.

Last update: 2025-10-07 18:09:16 UTC


README

Build Status

Namespacery is a simple PHP library to help parse namespaces in an easily-accessible way.

Installation

The library can be installed with Composer, by including the following in your composer.json:

{
    "require": {
        "xenolope/namespacery": "0.*"
    }
}

Usage

$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();

License

Namespacery is released under the MIT License; please see LICENSE for more information.