PHPackages                             fratily/path-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. fratily/path-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

fratily/path-parser
===================

0.2.0(4y ago)02001MITPHPPHP ^8.0

Since Nov 14Pushed 4y agoCompare

[ Source](https://github.com/fratily/path-parser)[ Packagist](https://packagist.org/packages/fratily/path-parser)[ RSS](/packages/fratily-path-parser/feed)WikiDiscussions master Synced today

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

Fratily Path Parser
===================

[](#fratily-path-parser)

`fratily/path-parser` is parser of url pathname.

Install
-------

[](#install)

```
$ composer require fratily/path-parser
```

Usage
-----

[](#usage)

```
$segments = \Fratily\PathParser\PathParser::parse('/foo/:id/bar/', [
    \Fratily\PathParser\Segments\SlashSegment::class,
    CustomSegment::class,
    \Fratily\PathParser\Segments\PlainSegment::class,
]);

var_dump(
    // /foo
    get_class($segments[0]), // "Fratily\PathParser\Segments\PlainSegment"
    $segments[0]->getSegment(), // "/foo"
    // /:id
    get_class($segments[1]), // "CustomSegment"
    $segments[0]->getName(), // "/id"
    // /bar
    get_class($segments[2]), // "Fratily\PathParser\Segments\PlainSegment"
    $segments[0]->getSegment(), // "/bar"
    // /
    get_class($segments[3]), // "Fratily\PathParser\Segments\SlashSegment"
);

class CustomSegment implements \Fratily\PathParser\Segments\SegmentInterface
{
    private string $name;

    public static function new(string $plainSegment): CustomSegment|null
    {
        if (1 !== preg_match('/\A:([a-z]+)\z/i', $plainSegment, $m)) {
            return null;
        }

        $obj = new CustomSegment();
        $obj->name = $m[1];
        return $obj;
    }

    public static function getName(): string
    {
        return $this->name;
    }
}
```

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

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

Total

2

Last Release

1686d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c0575d05e23e7ef9b1046a7a922927199c86ef292ebb188758bb214621d7efc?d=identicon)[kento-oka](/maintainers/kento-oka)

---

Top Contributors

[![kento-oka](https://avatars.githubusercontent.com/u/30544668?v=4)](https://github.com/kento-oka "kento-oka (5 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fratily-path-parser/health.svg)

```
[![Health](https://phpackages.com/badges/fratily-path-parser/health.svg)](https://phpackages.com/packages/fratily-path-parser)
```

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19139.2M47](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9843.5k](/packages/sauladam-shipment-tracker)[jstewmc/rtf

Read and write Rich Text Format (RTF) documents with PHP

45153.1k6](/packages/jstewmc-rtf)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.2k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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