PHPackages                             joomla/uri - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. joomla/uri

ActiveJoomla-package[Framework](/categories/framework)

joomla/uri
==========

Joomla Uri Package

4.0.0(9mo ago)6728.0k—8.1%9[1 issues](https://github.com/joomla-framework/uri/issues)18GPL-2.0-or-laterPHPPHP ^8.3.0CI passing

Since Jun 4Pushed 9mo ago12 watchersCompare

[ Source](https://github.com/joomla-framework/uri)[ Packagist](https://packagist.org/packages/joomla/uri)[ Docs](https://github.com/joomla-framework/uri)[ RSS](/packages/joomla-uri/feed)WikiDiscussions 3.x-dev Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (24)Used By (18)

The Uri Package [![Build Status](https://github.com/joomla-framework/uri/actions/workflows/ci.yml/badge.svg?branch=3.x-dev)](https://github.com/joomla-framework/uri)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#the-uri-package-)

[![Latest Stable Version](https://camo.githubusercontent.com/cb030a8ab75d9d52217e2f3dfdf626383f78f889ce53ca1a55d9dd84f28df1ce/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f7572692f762f737461626c65)](https://packagist.org/packages/joomla/uri)[![Total Downloads](https://camo.githubusercontent.com/acaca5a8ab297bb42997d306e3b6575b70152c63a02f9190fac63eeccfafb0e6/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f7572692f646f776e6c6f616473)](https://packagist.org/packages/joomla/uri)[![Latest Unstable Version](https://camo.githubusercontent.com/d6d1b6d31c7bb853951265a58ea1d2d304c03bb0c0cf1f8774ea07d5576ba74b/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f7572692f762f756e737461626c65)](https://packagist.org/packages/joomla/uri)[![License](https://camo.githubusercontent.com/de12b366cac6b3d84f056fcce956d1aa49cb4c1737dfeab3a0f0dd7cd2efc5d1/68747470733a2f2f706f7365722e707567782e6f72672f6a6f6f6d6c612f7572692f6c6963656e7365)](https://packagist.org/packages/joomla/uri)

### Introduction

[](#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.

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 `UriHelper`class.

The Uri class is a mutable object which you'd use to manipulate an Uri.

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.

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.

The `UriHelper` class only contains one method parse\_url() that's an UTF-8 safe replacement for PHP's parse\_url().

You can use the `Uri` class a number of different ways when dealing with Uris. It is very easy to construct a uri programmatically using the methods provided in the `Uri` class.

### Usage

[](#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:

```
