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(6mo ago)06GPL-3.0-or-laterPHPPHP ^8.1CI passing

Since Dec 11Pushed 6mo 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 today

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

32

—

LowBetter than 69% of packages

Maintenance66

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

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

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[illuminate/session

The Illuminate Session package.

9939.3M847](/packages/illuminate-session)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[symfony/ux-autocomplete

JavaScript Autocomplete functionality for Symfony

645.9M39](/packages/symfony-ux-autocomplete)[illuminate/cookie

The Illuminate Cookie package.

244.6M137](/packages/illuminate-cookie)[terminal42/contao-url-rewrite

URL Rewrite bundle for Contao Open Source CMS

15102.5k3](/packages/terminal42-contao-url-rewrite)

PHPackages © 2026

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