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

Recommend this page to a friend!

  Author Author  
Picture of Payam Naderi
Name: Payam Naderi <contact>
Classes: 14 packages by
Country: United States United States
Innovation award
Innovation award
Nominee: 2x


  Detailed description   Download Download .zip .tar.gz  
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.

Details

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

  Classes of Payam Naderi  >  PHP URL Parse Library  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP URL Parse Library
Base name: pathuri
Description: Parse and edit the URI of a site page
Version: -
PHP version: 5
License: MIT/X Consortium License
 
  Groups   Applications   Files Files  

  Groups  
Group folder image HTTP HTTP protocol clients, headers and cookies View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Parsers Programming language interpreters and format parsers View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  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

Download Download all files: pathuri.tar.gz pathuri.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.

For more information send a message to info at phpclasses dot org.