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

ActiveLibrary

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 1mo 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 54% 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

3843d 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

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.0B3.2k](/packages/guzzlehttp-psr7)[symfony/routing

Maps an HTTP request to a set of configuration variables

7.6k789.4M1.8k](/packages/symfony-routing)[league/uri

URI manipulation library

1.1k206.4M277](/packages/league-uri)[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

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

Parse, build and manipulate URL's

73914.3M97](/packages/spatie-url)[nette/http

🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and utility for URL and cookies manipulation.

48619.2M541](/packages/nette-http)

PHPackages © 2026

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