PHPackages                             markocupic/url-util - 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. markocupic/url-util

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

markocupic/url-util
===================

Parse and manipulate urls in a Symfony Environment

1.0.0(5mo ago)06GPL-3.0-or-laterPHPPHP ^8.1CI passing

Since Dec 11Pushed 5mo agoCompare

[ Source](https://github.com/markocupic/url-util)[ Packagist](https://packagist.org/packages/markocupic/url-util)[ RSS](/packages/markocupic-url-util/feed)WikiDiscussions main Synced 1mo ago

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

[![Alt text](docs/logo.png?raw=true "logo")](docs/logo.png?raw=true)

Url Util
========

[](#url-util)

A lightweight Symfony library that provides utility methods for working with URLs. It allows you to **add or remove query parameters** of a URL. If no URL is provided, the current request URL is used automatically.

---

✨ Features
----------

[](#-features)

- Add query parameters to a URL
- Remove one or more query parameters
- **Automatically falls back to the current request URL when no URL is passed**
- Cleans up encoded ampersands (`&amp;` → `&`)

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require markocupic/url-util
```

🚀 Usage
-------

[](#-usage)

Inject the UrlUtil service into your controller or service:

```
class DemoController
{
    public function index(UrlUtil $urlUtil)
    {
        // Current request URL: https://example.com/page?foo=bar

        // Add a single query parameter
        $newUrl = $urlUtil->addQueryParam('foo_one', 'bar');
        // Result: https://example.com/page?foo_one=bar

        // Add an array parameter
        $newUrl = $urlUtil->addQueryParams('foo_two', 'biz,buz'], $newUrl);
        // Result: https://example.com/page?foo_one=bar&foo_two[]=biz&foo_two[]=buz

        // Remove one or more query parameters
        $url = 'https://example.com/page?foo=bar&baz=qux';
        $newUrl = $urlUtil->removeQueryParam(['foo'], $url);
        // Result: https://example.com/page?baz=qux
    }
}
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance72

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

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 ~1 days

Total

2

Last Release

156d ago

Major Versions

0.0.1 → 1.0.02025-12-13

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1525166?v=4)[Marko Cupic](/maintainers/markocupic)[@markocupic](https://github.com/markocupic)

---

Top Contributors

[![markocupic](https://avatars.githubusercontent.com/u/1525166?v=4)](https://github.com/markocupic "markocupic (3 commits)")

---

Tags

urladd query parameter to urlremove query parameter from url

### Embed Badge

![Health badge](/badges/markocupic-url-util/health.svg)

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

###  Alternatives

[spatie/url

Parse, build and manipulate URL's

73914.3M97](/packages/spatie-url)[jbroadway/urlify

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

6737.4M62](/packages/jbroadway-urlify)[league/uri-components

URI components manipulation library

31932.3M67](/packages/league-uri-components)[sabre/uri

Functions for making sense out of URIs.

29335.2M40](/packages/sabre-uri)[spomky-labs/base64url

Base 64 URL Safe Encoding/Decoding PHP Library

15439.5M49](/packages/spomky-labs-base64url)[misd/linkify

Converts URLs and email addresses in text into HTML links

1122.9M10](/packages/misd-linkify)

PHPackages © 2026

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