PHP Classes

PHP URL Parse Library: Parse and edit the URI of a site page

Recommend this page to a friend!
  Info   View files Documentation   View files View files (14)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 73 This week: 1All time: 10,197 This week: 560Up
Version License PHP version Categories
pathuri 1.0MIT/X Consortium ...5HTTP, PHP 5, Parsers
Description 

Author

This package can parse and edit the URI of a site page.

It can take an absolute or relative URI of a Web site page to extract URI parts.

The package can also perform several types of operations to change parts of the URI like normalizing the URL, prepend a given URI path, and return the string of the resulting URL after making the editing changes.

Picture of Payam Naderi
  Performance   Level  
Name: Payam Naderi <contact>
Classes: 15 packages by
Country: United States United States
Age: 41
All time rank: 2019286 in United States United States
Week rank: 106 Up12 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

Documentation

Poirot\PathUri

Powerful while Remaining Simple to use library to ease URL parsing and editing in PHP.

General Usage

__PathJoinedUri__

Basic Path Interfaces iPathJoinedUri

### Build object from construct ---------------------------------------------------
$joinedPath = new PathJoinUri([
    # (!) when you pass a path on construct
    #     you have to set separator
    'path' => '/var/www/html/',                        # <-----
                                                       #      |
    # path also can build upon series of array list           | same in path
    'path' => ['', 'var', 'www', 'html'],              # <-----
    #          ^ this mean absolute path starting with "/"
    # (!) in this form separator is not necessary

    # default separator is "/"
    'separator' => '/'
]);

### Build Existing Object -------------------------------------------------------
$newPath = (new PathJoinUri)->setSeparator('\\');
                                   # ^ you have to set separator before parse()
$parsedUri = $newPath->parse('\\..\\htdocs\\project\\');
         # = ['path' => ['', '..', 'htdocs', 'project']]

$newPath->fromArray($parsedUri);

## print out path
echo $newPath
    ->toString()
    .'<br/>';
# output : \..\htdocs\project

### Append/Prepend Paths --------------------------------------------------------
$joinedPath->append($newPath);

echo $joinedPath->toString().'<br/>';;
# output: /var/www/html/../htdocs/project

# normalize output
echo $joinedPath->normalize()->toString().'<br/>';;
# output: /var/www/htdocs/project

# (!) Paths starting with "../" turning path into relative on normalize
$joinedPath->prepend(new PathJoinUri(['path' => '/../relative']));
echo $joinedPath->toString().'<br/>';
# output: /../relative/var/www/htdocs/project
echo $joinedPath->normalize()->toString().'<br/>';
# output: relative/var/www/htdocs/project

  Files folder image Files  
File Role Description
Files folder imageHttp (1 file)
Files folder imageInterfaces (5 files)
Files folder imagePsr (1 file)
Plain text file aUri.php Class Class source
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Plain text file UriHttp.php Class Class source
Plain text file UriPathName.php Class Class source
Plain text file UriSequence.php Class Class source
Accessible without login Plain text file _functions.php Aux. Auxiliary script

  Files folder image Files  /  Http  
File Role Description
  Plain text file DataQueryParams.php Class Class source

  Files folder image Files  /  Interfaces  
File Role Description
  Plain text file iDataQueryParams.php Class Class source
  Plain text file iUriBase.php Class Class source
  Plain text file iUriHttp.php Class Class source
  Plain text file iUriPathName.php Class Class source
  Plain text file iUriSequence.php Class Class source

  Files folder image Files  /  Psr  
File Role Description
  Plain text file UriHttpBridgeInPsr.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:73
This week:1
All time:10,197
This week:560Up