PHPackages                             romeoz/rock-url - 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. romeoz/rock-url

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

romeoz/rock-url
===============

A simple PHP library to parse and builder URLs

0.12.1(10y ago)01.4k4MITPHPPHP &gt;=5.4.0

Since Feb 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/romeOz/rock-url)[ Packagist](https://packagist.org/packages/romeoz/rock-url)[ RSS](/packages/romeoz-rock-url/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (2)Versions (14)Used By (4)

URL builder library for PHP
===========================

[](#url-builder-library-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/5973c451c3106509d5dd9fef46a3ef1fc0253d4b5d96c181dee0ade508b4f0b1/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d75726c2f762f737461626c652e737667)](https://packagist.org/packages/romeOz/rock-url)[![Total Downloads](https://camo.githubusercontent.com/c3e3043230634b4264e9b5169ed785fa1ca6e6a25f3dbf58529094e87bcb3626/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d75726c2f646f776e6c6f6164732e737667)](https://packagist.org/packages/romeOz/rock-url)[![Build Status](https://camo.githubusercontent.com/f086e3581dffe39db83b7a572d28e65b99657e12b4ff5a20ac8ab1ef0ac51ace/68747470733a2f2f7472617669732d63692e6f72672f726f6d654f7a2f726f636b2d75726c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/romeOz/rock-url)[![HHVM Status](https://camo.githubusercontent.com/468a920adab6b22a60e7d167287646987fb706defe130ef497df4eb51fe399fe/687474703a2f2f6868766d2e683463632e64652f62616467652f726f6d656f7a2f726f636b2d75726c2e737667)](http://hhvm.h4cc.de/package/romeoz/rock-url)[![Coverage Status](https://camo.githubusercontent.com/4bcbafaf344e61b18293b8811ae50c705328b98b632b81fce60434bfb73ae4bb/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f726f6d654f7a2f726f636b2d75726c2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/romeOz/rock-url?branch=master)[![License](https://camo.githubusercontent.com/79bb741971c0f39f3c68b241b87d2ae4677dcc57acb3519af978e7a0e53bb746/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d75726c2f6c6963656e73652e737667)](https://packagist.org/packages/romeOz/rock-url)

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

[](#installation)

From the Command Line:

```
composer require romeoz/rock-url

```

In your composer.json:

```
{
    "require": {
        "romeoz/rock-url": "*"
    }
}
```

Quick Start
-----------

[](#quick-start)

```
use rock\url\Url;

// example URL: http://site.com/foo/?page=1

// returns relative URL
(new Url)->getRelative(); // output: /foo/?page=1

// modify URL
Url::set('https://site.com/?page=2#name')->removeFragment()->getRelative();
//output: /?page=2

Url::set('https://site.com/?page=2#name')->removeQueryParams(['page'])->getAbsolute();
//output: https://site.com/#name
```

\###Short method `modify()`

```
Url::modify(['https://site.com/', 'foo' => 'test', '#' => 'name']);
//output: /?foo=test#name

Url::modify(['https://site.com/?foo=test#name', '!foo', '!#', '@scheme' => Url::ABS]);
//output: https://site.com/

// modify current url
Url::modify([foo' => 'test]);
//output: /?foo=test
```

Requirements
------------

[](#requirements)

- **PHP 5.4+**
- For generating CSRF-token (security) required [Rock CSRF](https://github.com/romeOz/rock-csrf): `composer require romeoz/rock-csrf`

> All unbolded dependencies is optional

License
-------

[](#license)

Rock URL library is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

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

Every ~21 days

Total

13

Last Release

3892d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23c5d84a59845d751cb69f5469986579b9312c54c898b366fefdc05baaa80a9c?d=identicon)[romeOz](/maintainers/romeOz)

---

Top Contributors

[![romeOz](https://avatars.githubusercontent.com/u/3135712?v=4)](https://github.com/romeOz "romeOz (62 commits)")

---

Tags

urlparse\_urlurl builder

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/romeoz-rock-url/health.svg)

```
[![Health](https://phpackages.com/badges/romeoz-rock-url/health.svg)](https://phpackages.com/packages/romeoz-rock-url)
```

###  Alternatives

[spatie/url

Parse, build and manipulate URL's

74115.7M123](/packages/spatie-url)[league/uri-components

URI components manipulation library

31940.5M98](/packages/league-uri-components)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6758.1M80](/packages/jbroadway-urlify)[sabre/uri

Functions for making sense out of URIs.

29437.7M45](/packages/sabre-uri)[spomky-labs/base64url

Base 64 URL Safe Encoding/Decoding PHP Library

15442.9M61](/packages/spomky-labs-base64url)[opis/uri

Build, parse and validate URIs and URI-templates

2126.4M8](/packages/opis-uri)

PHPackages © 2026

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