PHPackages                             peterpostmann/resolve\_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. peterpostmann/resolve\_uri

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

peterpostmann/resolve\_uri
==========================

Resolves relative urls, like a browser would

1.0.0(8y ago)0471MITPHP

Since Nov 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/peterpostmann/php-resolve_uri)[ Packagist](https://packagist.org/packages/peterpostmann/resolve_uri)[ RSS](/packages/peterpostmann-resolve-uri/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (2)Used By (1)

resolve\_uri
============

[](#resolve_uri)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/f978395d5d1ecda96724abd8f085b994571be6ffdf897c4f2d7f2ba701d4d9b1/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7065746572706f73746d616e6e2f7068702d7265736f6c76655f7572692f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/peterpostmann/php-resolve_uri)

Resolves relative urls, like a browser would.

This function returns a new URI based on base path ([RFC3986](https://tools.ietf.org/html/rfc3986/) URL, URN, Windows path, relative path or file) and a new path.

Install
-------

[](#install)

### Via Composer

[](#via-composer)

```
composer require peterpostmann/resolve_uri
```

If you dont want to use composer copy the `resolve_uri.php` file and from \[peterpostmann\\php-parse\_uri\]\[2\] the `parse_uri.php` file and include it into your project.

Usage
-----

[](#usage)

```
use function peterpostmann\uri\resolve_uri;

string resolve_uri ( string basePath, string newPath)
```

### Example

[](#example)

#### parse URIs

[](#parse-uris)

```
use function peterpostmann\uri\resolve_uri;

echo resolve_uri('http://a/b/c/d;p?q#x',    'x')."\n";
echo resolve_uri('C:\path\file1.ext',       'file2.ext')."\n";
echo resolve_uri('file://smb/path/to/file', '/new/path/x.ext')."\n";
```

The above example will output:

```
http://a/b/c/x
C:\path\file2.ext
file://smb/new/path/x.ext
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3100d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9362588b9edca85b56850256b890ab5e0f94670fa50e460a9547192785eb880b?d=identicon)[peterpostmann](/maintainers/peterpostmann)

---

Top Contributors

[![peterpostmann](https://avatars.githubusercontent.com/u/9541377?v=4)](https://github.com/peterpostmann "peterpostmann (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

PHPackages © 2026

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