This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (0.1.1) of this package.

Maintainers

Package info

github.com/JosephMoniz/php-path

pkg:composer/plasmaconduit/path

Statistics

Installs: 855

Dependents: 0

Suggesters: 0

Stars: 9

Open Issues: 4

0.1.1 2013-01-23 06:47 UTC

This package is not auto-updated.

Last update: 2016-11-19 07:19:46 UTC


README

Build Status

Simple and care free file path concatenation and simplification.

<?php
use PlasmaConduit\Path;

Path::join("wat", "lol");              // -> wat/lol
Path::join("/a", "///b");              // -> /a/b
Path::join("/a", "b", "c", "..", "d"); // -> /a/b/d

Path::normalize("/a/b/c/../d");       // -> /a/b/d
Path::normalize("/a/b/c/../../d");    // -> /a/d
Path::normalize("/b/wat//");          // -> /b/wat/
Path::normalize("/b///wat/");         // -> /b/wat/
Path::normalize("");                  // -> .
Path::normalize("/");                 // -> /

Public Interface

namespace PlasmaConduit;

class Path {

    /**
     * This function takes a variable amount of strings and joins
     * them together so that they form a valid file path.
     *
     * @param {String ...} $peice - The peices of the file path
     * @returns {String}          - The final file path
     */
    static public function join();

    /**
     * This function takes a valid file path and nomalizes it into
     * the simplest form possible.
     *
     * @param {String} $path - The path to normalize
     * @returns {String}     - The normailized path
     */
    static public function normalize($path);

}