PHPackages                             ismaxim/urling - 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. ismaxim/urling

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

ismaxim/urling
==============

URL parser and constructor in PHP

v1.0.0(5y ago)536[3 PRs](https://github.com/ismaxim/urling/pulls)MITPHPPHP ^7.4|^8.0

Since Mar 19Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ismaxim/urling)[ Packagist](https://packagist.org/packages/ismaxim/urling)[ Docs](https://github.com/ismaxim/urling)[ RSS](/packages/ismaxim-urling/feed)WikiDiscussions master Synced 6d ago

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

[![Urling - url parser & constructor](https://raw.githubusercontent.com/ismaxim/urling/master/assets/hero-image.png "Urling")](https://github.com/ismaxim/urling#%EF%B8%8F-installation)

[![Build Status](https://camo.githubusercontent.com/8546cb5d81eb7f0f6448e350fad19eb712ddc8afb0d961809e62c5e51029128b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f69736d6178696d2f75726c696e672f4275696c643f6c6162656c3d6275696c64266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465267374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/8546cb5d81eb7f0f6448e350fad19eb712ddc8afb0d961809e62c5e51029128b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f69736d6178696d2f75726c696e672f4275696c643f6c6162656c3d6275696c64266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465267374796c653d666f722d7468652d6261646765)

**Urling**
==========

[](#urling)

> 🌐 [Документация на русском →](https://github.com/ismaxim/urling/blob/master/assets/README-RU.md) | [Документація на українській →](https://github.com/ismaxim/urling/blob/master/assets/README-UA.md)

⚙️ Installation
---------------

[](#️-installation)

To install this library - run the command below in your terminal:

```
composer require ismaxim/urling
```

🧙 Usage
-------

[](#-usage)

### 📖 Concept

[](#-concept)

#### Three major ideas

[](#three-major-ideas)

📗 1. Two modes to work with URL: parser mode &amp; constructor mode.
📘 2. Accessing to concrete part of URL with using aliases (see [ACCESSING TABLE](#accessing-table), column [Aliases](#aliases)).
📙 3. Base editors for processing complete URL and each part separately (see section [Basic usage](https://github.com/ismaxim/urling#-basic-usage)).

---

### 🚀 Start

[](#-start)

```
# Url parser mode

use Urling\Urling;

$urling = new Urling("https://github.com/ismaxim/urling#start");

$url_part_values = [
    "protocol_value" => $urling->url->protocol->get(),
    "domain_value"   => $urling->url->domain->get(),
    "routes_value"   => $urling->url->routes->get(),
    "anchor_value"   => $urling->url->anchor->get(),
];

print_r($url_part_values);

/*
    RESULT:

    [
        "protocol_value" => "https",
        "domain_value"   => "github.com",
        "routes_value"   => "ismaxim/urling",
        "anchor_value"   => "start",
    ]
*/
```

```
# Url constructor mode

use Urling\Urling;

$urling = new Urling();

$urling->url->construct([
    "protocol" => "https",
    "domain"   => "github.com",
    "routes"   => "ismaxim/urling",
    "anchor"   => "start",
]);

// Either you can set the value for each distinct part
// in the url by accessing it directly, for example:

$urling->url->protocol->add("https");
$urling->url->domain->add("github.com");
$urling->url->routes->add("ismaxim/urling");
$urling->url->anchor->add("start");

print_r($urling->url->get());

/*
    RESULT:

    "https://github.com/ismaxim/urling#start"
*/
```

#### 🔑 Accessing

[](#-accessing)

---

You can access to concrete URL part to parse it by using its basename (see [ACCESSING TABLE](#accessing-table), column [Url Part](#url-part)) or ask for its alias (see [ACCESSING TABLE](#accessing-table), column [Aliases](#aliases)) like:

```
$urling->url->scheme->... | $urling->url->protocol->... (other parts of url in a similar way).
```

**ACCESSING TABLE**

Url PartAliasesParserschemeprotocol[SchemeParser](https://bit.ly/3vOpzbs)userusername[UserParser](https://bit.ly/2NLCWYQ)passpassword[PassParser](https://bit.ly/3lPdkXG)hosthostname, domain[HostParser](https://bit.ly/394KA8c)port[PortParser](https://bit.ly/39aiMz0)pathroutes[PathParser](https://bit.ly/3lEZS8H)queryparams, attributes[QueryParser](https://bit.ly/3d0VaOu)fragmentanchor[FragmetParser](https://bit.ly/3tKfI4C)#### 👶 Basic usage

[](#-basic-usage)

---

**Basic Editors** - [Base editor of URL](https://bit.ly/3vXg0qA) and [Base editor of part of URL](https://bit.ly/3tNXSgZ) cover almost all tasks: ***add, get, update or remove*** URL or values anywhere in it. **Base Editors** are "CRUDable" wrappers over the **parse\_url()** function from native PHP, and according to this fact, they return and modify values in a similar way. The only significant difference is the syntax of calls when parsing a URL or its parts.

```
// Working with URL

$urling->url->add();
$urling->url->get();
$urling->url->update();
$urling->url->delete();

// Working with one of the URL parts

$urling->url->scheme->add();
$urling->url->scheme->get();
$urling->url->scheme->update();
$urling->url->scheme->delete();

// For example, let's imagine that the URL is: https://github.com/ismaxim/urling#basic-usage
// Then example workflow to parse this URL in part of "scheme" or "protocol" (see ACCESSING TABLE, column "Aliases") will seem to this:

$urling->url->scheme->get();          # returns "https" (state of URL: https://github.com/ismaxim/urling#basic-usage)
$urling->url->scheme->delete();       # returns null    (state of URL: github.com/ismaxim/urling#basic-usage)
$urling->url->scheme->add("ftp");     # returns "ftp"   (state of URL: ftp://github.com/ismaxim/urling#basic-usage)
$urling->url->scheme->update("smtp"); # returns "smtp"  (state of URL: smtp://github.com/ismaxim/urling#basic-usage)

// Work with other parts of URL can be done in a similar way.
```

#### 🧔 Advanced usage

[](#-advanced-usage)

---

If you need to do something like ***add, get, update or delete*** the value of any part of the URL, but it's outside the scope of the base functionality, you can use one of the Base editors functions ***add, get, update or delete*** as a prefix with the name of a specific method as postfix appropriate for your task like:

> (add, get, update, delete) + "SomeFunctionName" for the concrete task.

Note: *Almost all functions will use that code convention permanently.*

Examples:

- getValueByName();
- getNameValuePairs();
- etc. ...

```
$urling->url->params->getValueByName();
$urling->url->params->getNameValuePairs();
```

🧪 Testing
---------

[](#-testing)

*Actually, all tests already automatically passed within CI build.*

To test this library - run the command below in your terminal.

```
composer test
```

🤝 Contributing
--------------

[](#-contributing)

If you have a problem that cannot be solved using this library, please write your solution and if you want to help other developers who also use this library (or if you want to keep your solution working after a new version is released, which will go to package manager dependencies) - create a pull-request. We will be happy to add your excellent code to the library!

🐞 Report any bugs or issues you find on the [GitHub issues](https://github.com/ismaxim/urling/issues).

### ✨ Creating custom functional

[](#-creating-custom-functional)

You can extend the functionality of the library with your own code, making edits to solve your problems in the parser classes. There are two types of parser classes the first and the main is [URL parser](https://github.com/ismaxim/urling/blob/master/src/Urling/Core/Url.php), but there are others as well, - [URL parts parsers](https://github.com/ismaxim/urling/tree/master/src/Urling/PartParsers). For each part is separate own parser.

Using the library or examining docs you can notice the same or similar to this record:

```
$urling->url->params->get()
```

This entry might interpret the next way: "Hey, Urling, ask to the part 'params' on the current URL and return it value(this part)".

Basically extending functionality, you will work with a part of the URL almost all times and will processing or get the value for a specific part. To understand how to access to parser for needed part you can look at [ACCESSING TABLE](#accessing-table). You only need to match the [***url part***](#url-part) and [***aliases***](#aliases) sections with the [***parser***](#parser) section, and then go to the desired parser file and write the best code in the world!

📎 Credits
---------

[](#-credits)

- [Maintainer →](https://github.com/ismaxim)
- [Contributors →](https://github.com/ismaxim/urling/contributors)

📃 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 96.3% 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

1876d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/be4625974b60a7530d4958362acd24d6b33626e8722ef6bec9a9ee0d8e68e470?d=identicon)[MaximGrynykha](/maintainers/MaximGrynykha)

---

Top Contributors

[![maximgrynykha](https://avatars.githubusercontent.com/u/52281440?v=4)](https://github.com/maximgrynykha "maximgrynykha (181 commits)")[![roman-grynykha](https://avatars.githubusercontent.com/u/30489826?v=4)](https://github.com/roman-grynykha "roman-grynykha (4 commits)")[![labyou](https://avatars.githubusercontent.com/u/53494036?v=4)](https://github.com/labyou "labyou (2 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

create-uricreate-urlphpuriuri-builderuri-constructoruri-extenduri-manipulationuri-parserurisurlurl-builderurl-constructorurl-extendurl-manipulationurl-parserurlingurlsurlphpurl builderurl-parserurlingurl constructor

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ismaxim-urling/health.svg)

```
[![Health](https://phpackages.com/badges/ismaxim-urling/health.svg)](https://phpackages.com/packages/ismaxim-urling)
```

###  Alternatives

[rowbot/url

A WHATWG URL spec compliant URL parser for working with URLs and their query strings.

19648.2k4](/packages/rowbot-url)

PHPackages © 2026

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