2017 © Pedro Peláez
 

joomla-package uri

Joomla Uri Package

image

joomla/uri

Joomla Uri Package

  • Saturday, July 14, 2018
  • by mbabker
  • Repository
  • 11 Watchers
  • 1 Stars
  • 128,456 Installations
  • PHP
  • 19 Dependents
  • 2 Suggesters
  • 6 Forks
  • 1 Open issues
  • 11 Versions
  • 9 % Grown

The README.md

The Uri Package Build Status

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Introduction

The Joomla Framework includes a Uri package that allows for manipulating pieces of the Uri string with a number of useful methods to set and get values while dealing with the uri., (*2)

The classes that are included with the Uri package are Uri, which extends the UriAbstract class, an implementation of the UriInterface. Another class is the UriHelperclass., (*3)

The Uri class is a mutable object which you'd use to manipulate an Uri., (*4)

To pass along an uri as value use UriImmutable, this object guarantees that the code you pass the object into can't manipulate it and, causing bugs in your code., (*5)

If only read access is required it's recommended to type hint against the UriInterface. This way either an Uri or an UriImmutable object can be passed., (*6)

The UriHelper class only contains one method parse_url() that's an UTF-8 safe replacement for PHP's parse_url()., (*7)

You can use the Uri class a number of different ways when dealing with Uris. It is very easy to construct a uri programatically using the methods provided in the Uri class., (*8)

Usage

The methods provided in the Uri class allow you to manipulate all aspects of a uri. For example, suppose you wanted to set a new uri, add in a port, and then also post a username and password to authenticate a .htaccess security file. You could use the following syntax:, (*9)

<?php
// new uri object
$uri = new Joomla\Uri\Uri;

$uri->setHost('http://localhost');
$uri->setPort('8888');
$uri->setUser('myUser');
$uri->setPass('myPass');

echo $uri->__toString();

This will output:, (*10)

myUser:myPass@http://localhost:8888, (*11)

If you wanted to add a specific filepath after the host you could use the setPath() method:, (*12)

<?php
// set path
$uri->setPath('path/to/file.php');

Which will output myUser:myPass@http://localhost:8888path/to/file.php, (*13)

Adding a URL query:, (*14)

<?php
// url query
$uri->setQuery('foo=bar');

Output:, (*15)

myUser:myPass@http://localhost:8888path/to/file.php?foo=bar, (*16)

Installation via Composer

Add "joomla/uri": "~1.0" to the require block in your composer.json and then run composer install., (*17)

{
    "require": {
        "joomla/uri": "~1.0"
    }
}

Alternatively, you can simply run the following from the command line:, (*18)

composer require joomla/uri "~1.0"

The Versions

14/07 2018

dev-2.0-dev

dev-2.0-dev https://github.com/joomla-framework/uri

Joomla Uri Package

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

  • php ~7.0

 

The Development Requires

framework uri joomla

01/07 2018

dev-master

9999999-dev https://github.com/joomla-framework/uri

Joomla Uri Package

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

  • php ^5.3.10|~7.0

 

The Development Requires

framework uri joomla

01/07 2018

1.2.0

1.2.0.0 https://github.com/joomla-framework/uri

Joomla Uri Package

  Sources   Download

GPL-2.0-or-later

The Requires

  • php ^5.3.10|~7.0

 

The Development Requires

framework uri joomla

06/04 2018

dev-psr7

dev-psr7 https://github.com/joomla-framework/uri

Joomla Uri Package

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

 

The Development Requires

framework uri joomla

09/02 2014

1.1.1

1.1.1.0 https://github.com/joomla-framework/uri

Joomla Uri Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework uri joomla

23/10 2013

1.0

1.0.0.0 https://github.com/joomla/joomla-framework-uri

Joomla Uri Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework uri joomla

23/10 2013

1.1.0

1.1.0.0 https://github.com/joomla/joomla-framework-uri

Joomla Uri Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework uri joomla

22/10 2013

1.0-beta3

1.0.0.0-beta3 https://github.com/joomla/joomla-framework-uri

Joomla Uri Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework uri joomla

04/06 2013

1.0-alpha

1.0.0.0-alpha https://github.com/joomla/joomla-framework-uri

Joomla Uri Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework uri joomla

04/06 2013

1.0-beta

1.0.0.0-beta https://github.com/joomla/joomla-framework-uri

Joomla Uri Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework uri joomla

04/06 2013

1.0-beta2

1.0.0.0-beta2 https://github.com/joomla/joomla-framework-uri

Joomla Uri Package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

framework uri joomla