PHPackages                             fyre/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fyre/uri

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fyre/uri
========

A URI library.

v4.0.1(7mo ago)0407↓84.6%3MITPHP

Since Dec 1Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/elusivecodes/FyreUri)[ Packagist](https://packagist.org/packages/fyre/uri)[ RSS](/packages/fyre-uri/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (10)Dependencies (5)Versions (33)Used By (3)

FyreURI
=======

[](#fyreuri)

**FyreURI** is a free, open-source immutable URI library for *PHP*.

Table Of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Methods](#methods)

Installation
------------

[](#installation)

**Using Composer**

```
composer require fyre/uri

```

In PHP:

```
use Fyre\Http\Uri;
```

Basic Usage
-----------

[](#basic-usage)

- `$uriString` is a string representing the uri.

```
$uri = new Uri($uriString);
```

Alternatively, you can use the `createFromString` method for easier chaining.

```
$uri = Uri::createFromString($uriString);
```

Methods
-------

[](#methods)

**Get Authority**

Get the URI authority string.

```
$authority = $uri->getAuthority();
```

**Get Fragment**

Get the URI fragment.

```
$fragment = $uri->getFragment();
```

**Get Host**

Get the URI host.

```
$host = $uri->getHost();
```

**Get Path**

Get the URI path.

```
$path = $uri->getPath();
```

**Get Port**

Get the URI port.

```
$port = $uri->getPort();
```

**Get Query**

Get the URI query string.

```
$query = $uri->getQuery();
```

**Get Query Params**

Get the URI query params.

```
$params = $uri->getQueryParams();
```

**Get Scheme**

Get the URI scheme.

```
$scheme = $uri->getScheme();
```

**Get Segment**

Get a specified URI segment.

- `$segment` is a number indicating the segment index.

```
$part = $uri->getSegment($segment);
```

**Get Segments**

Get the URI segments.

```
$segments = $uri->getSegments();
```

**Get Total Segments**

Get the URI segments count.

```
$segmentCount = $uri->getTotalSegments();
```

**Get Uri**

Get the URI string.

```
$uriString = $uri->getUri();
```

**Get User Info**

Get the user info string.

```
$userInfo = $uri->getUserInfo();
```

**Resolve Relative Uri**

Clone the *Uri* with a resolved relative URI.

- `$relativeUri` is a string representing the relative uri.

```
$newUri = $uri->resolveRelativeUri($relativeUri);
```

**With Added Query**

Clone the *Uri* with a new query parameter.

- `$key` is a string representing the query key.
- `$value` is the query value.

```
$newUri = $uri->withAddedQuery($key, $value);
```

**With Authority**

Clone the *Uri* with a new authority.

- `$authority` is a string representing the authority.

```
$newUri = $uri->withAuthority($authority);
```

**With Fragment**

Clone the *Uri* with a new fragment.

- `$fragment` is a string representing the fragment.

```
$newUri = $uri->withFragment($fragment);
```

**With Host**

Clone the *Uri* with a new host.

- `$host` is a string representing the host.

```
$newUri = $uri->withHost($host);
```

**With Only Query**

Clone the *Uri* with only specific query parameters.

- `$keys` is an array containing the query parameters to keep.

```
$newUri = $uri->withOnlyQuery($keys);
```

**Without Query**

Clone the *Uri* without query parameters.

- `$keys` is an array containing the query parameters to remove.

```
$newUri = $uri->withoutQuery($keys);
```

**With Path**

Clone the *Uri* with a new path.

- `$path` is a string representing the path.

```
$newUri = $uri->withPath($path);
```

**With Port**

Clone the *Uri* with a new port.

- `$port` is a number representing the port.

```
$newUri = $uri->withPort($port);
```

**With Query**

Clone the *Uri* with a new query string.

- `$query` is a string representing the query parameters.

```
$newUri = $uri->withQuery($query);
```

**With Query Params**

Clone the *Uri* with new query parameters.

- `$params` is an array containing the query parameters.

```
$newUri = $uri->withQueryParams($params);
```

**With Scheme**

Clone the *Uri* with a new scheme.

- `$scheme` is a string representing the scheme.

```
$newUri = $uri->withScheme($scheme);
```

**With User Info**

Clone the *Uri* with new user info.

- `$username` is a string representing the username.
- `$password` is a string representing the password, and will default to *null*.

```
$newUri = $uri->withUserInfo($username, $password);
```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance62

Regular maintenance activity

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~46 days

Recently: every ~56 days

Total

32

Last Release

237d ago

Major Versions

v1.0.10 → v2.02022-04-04

v2.0.1 → v3.02023-07-14

v3.0.16 → v4.02025-10-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/fad81fd5941e3a637c8a5749d05ae3ed9314d5e2fee57f59c3d9ec3b41259c6b?d=identicon)[elusivecodes](/maintainers/elusivecodes)

---

Top Contributors

[![elusivecodes](https://avatars.githubusercontent.com/u/18050480?v=4)](https://github.com/elusivecodes "elusivecodes (20 commits)")

---

Tags

phpuri

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/fyre-uri/health.svg)

```
[![Health](https://phpackages.com/badges/fyre-uri/health.svg)](https://phpackages.com/packages/fyre-uri)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k496.1k33](/packages/neuron-core-neuron-ai)[spatie/laravel-export

Create a static site bundle from a Laravel app

672139.5k6](/packages/spatie-laravel-export)[razorpay/ifsc

Razorpay IFSC Codes Library

384204.4k](/packages/razorpay-ifsc)[anthropic-ai/sdk

Anthropic PHP SDK

160372.1k14](/packages/anthropic-ai-sdk)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35729.6k2](/packages/telnyx-telnyx-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
