PHPackages                             twifty/path - 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. twifty/path

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

twifty/path
===========

Collection of common methods for dealing with filesystem paths.

1.0(3y ago)010MITPHPPHP &gt;=7.0

Since Jan 16Pushed 3y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Contains a single static class with methods for manipulating filesystem paths.

Most of use are used to seeing:

```
$this->path = rtrim($path, '/').'/';
```

Problems arise when the path given is winbloze `C:\foo\bar` or for a stream wrapper `vfs://foo`

This package aims to provide commonly used methods for dealing with such paths.

```
class Path
{
    /**
     * Removes '.', '..' and terminating '/' from path.
     *
     * Also collapses multiple concurrent '/' characters.
     *
     * @param string $path
     *
     * @return string
     */
    public static function normalize(string $path): string;

    /**
     * Checks if $path has a valid prefix.
     *
     * @param string $path
     *
     * @return bool
     */
    public static function isAbsolute(string $path): bool;

    /**
     * Returns the absolute prefix of $path.
     *
     * For Unix style paths '/' is returned, for windows, 'c:/'
     * and for wrappers, the full scheme 'vfs://'. An empty
     * string is returned for relative paths.
     *
     * @param string $path
     *
     * @return string
     */
    public static function getPrefix(string $path): string;

    /**
     * Returns the directories/filename component of $path.
     *
     * The returned path is fully normalized.
     *
     * @param string $path
     *
     * @return string
     */
    public static function getHierarchy(string $path): string;

    /**
     * Returns both prefix and hierarchy of $path.
     *
     * @param string $path
     *
     * @return array
     */
    public static function split(string $path): array;

    /**
     * Appends to and normalizes $path.
     *
     * @param string $path
     * @param string $append
     *
     * @throws PathException
     *
     * @return string
     */
    public static function append(string $path, string $append): string;

    /**
     * Returns the normalized parent directory of $path.
     *
     * @param string $path
     *
     * @return string
     */
    public static function dirname(string $path): string;

    /**
     * Calculates the path between $source and $target.
     *
     * @param string $source
     * @param string $target
     * @return string
     * @throws PathException
     */
    public static function relativeTo(string $source, string $target): string;
}
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Unknown

Total

1

Last Release

1218d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/73d4870f2bfaf9cb32c0e26a7993779216a4f7112877107e51ecc4fd55282b27?d=identicon)[jmantila](/maintainers/jmantila)

---

Top Contributors

[![jaakkom](https://avatars.githubusercontent.com/u/1277004?v=4)](https://github.com/jaakkom "jaakkom (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel-frontend-presets/vuetify

Laravel 5.5+ Front-end preset for vuetify

8013.4k](/packages/laravel-frontend-presets-vuetify)[bigperson/auto-base-buy

The package allows you to access data through the base car by model

173.6k](/packages/bigperson-auto-base-buy)

PHPackages © 2026

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