PHPackages                             k911/uri-builder - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. k911/uri-builder

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

k911/uri-builder
================

UriBuilder library simplifies manipulation of Uri value objects compatible with PSR-7

v0.9.0(8y ago)04MITPHPPHP &gt;=7.1

Since Oct 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/k911/uri-builder)[ Packagist](https://packagist.org/packages/k911/uri-builder)[ RSS](/packages/k911-uri-builder/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

UriBuilder
==========

[](#uribuilder)

[![CircleCI](https://camo.githubusercontent.com/e4e00d45fef8048fb20cbc89345df722714d30e34473d6738935fec140be772e/68747470733a2f2f636972636c6563692e636f6d2f67682f6b3931312f7572692d6275696c6465722e7376673f7374796c653d737667)](https://circleci.com/gh/k911/uri-builder)

Simplifies manipulation of URI value objects compatible with PSR-7. Under the hood, it utilizes `League\Uri` powerful [library](http://uri.thephpleague.com/).

[![Code Climate](https://camo.githubusercontent.com/8c5c0f99d8e59dee5b9c4c898e4f0ef4948dc7d69687f6c7921b08e31545d06d/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6b3931312f7572692d6275696c6465722f6261646765732f6770612e737667)](https://codeclimate.com/github/k911/uri-builder)[![Test Coverage](https://camo.githubusercontent.com/f991ef76e1bf6fef794f08cd8f84d2165532ac3c67590f1c891c7f51bfe54f71/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6b3931312f7572692d6275696c6465722f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/k911/uri-builder/coverage)[![Issue Count](https://camo.githubusercontent.com/30db647f90a7ddfe031def920c9d3c906d5b56902be285301bf554ed5d1e6a24/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6b3931312f7572692d6275696c6465722f6261646765732f69737375655f636f756e742e737667)](https://codeclimate.com/github/k911/uri-builder)

- [Installation](#installation)
- [Supported Schemes](#supported-schemes)
- [Usage](#Usage)

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

[](#installation)

```
$ composer require k911/uri-builder

```

Supported Schemes
-----------------

[](#supported-schemes)

Currently supported, tested, URI schemes that UriBuilder can manage and parse from bare URI string or URI components.

- http/https
- ftp/sftp
- ws/wss
- file
- data

Usage
-----

[](#usage)

**Full public interface is available [here](src/UriBuilderInterface.php).**

Usage example:

```
// Simple URI string
$uri = 'wss://foo.bar:9999';

// Create UriBuilder and its dependencies
// ..you should either use DI container to manage it
// ..or use UriBuilder facade
$parser = new K911\UriBuilder\Adapter\UriParserAdapter();
$factory = new K911\UriBuilder\UriFactory($parser);
$builder = new K911\UriBuilder\UriBuilder($factory);

// Intiliaze UriBuilder with URI string
$builder->from($uri);
// or $builder->fromUri(UriInterface $uri);
// or $builder->fromComponents(array $components);

// UriBuilder is mutable, and allows method chaining
$builder
    // under the hood, it automatically transforms Uri object
    ->setScheme('https')
    // simple setters
    ->setHost('api.foo.bar')
    ->setFragment('foobar')
    // setting DEFAULT port for https scheme
    ->setPort(443)
    // domain-related paths must always start with forward slash '/'
    ->setPath('/v1')
    // query string is generated safely from pairs according to RFC3986
    ->setQuery([
        'api_token' => 'Qwerty! @#$TYu',
    ])
    // set user info (password can be omitted)
    ->setUserInfo('user', 'password');

// Print result
echo (string) $builder->getUri();
// https://user:password@api.foo.bar/v1?api_token=Qwerty%21%20%40%23%24TYu#foobar
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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

3142d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/81aea7f646860c419bafeae2c4d27e3a8e5541c12cb34e2c7a244619a4bdc370?d=identicon)[k911](/maintainers/k911)

---

Top Contributors

[![k911](https://avatars.githubusercontent.com/u/10072889?v=4)](https://github.com/k911 "k911 (17 commits)")

---

Tags

httppsr-7uribuilder

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.0B3.2k](/packages/guzzlehttp-psr7)[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

538204.9M23](/packages/league-uri-interfaces)[league/uri

URI manipulation library

1.1k206.4M277](/packages/league-uri)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[laminas/laminas-psr7bridge

Bidirectional conversions between PSR-7 and laminas-http messages

117.9M18](/packages/laminas-laminas-psr7bridge)[mezzio/mezzio-authentication-oauth2

OAuth2 (server) authentication middleware for Mezzio and PSR-7 applications.

28483.0k2](/packages/mezzio-mezzio-authentication-oauth2)

PHPackages © 2026

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