PHPackages                             perchten/truepath - 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. perchten/truepath

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

perchten/truepath
=================

Replace PHP's extremely buggy realpath()

1.0.0(12y ago)0492MITPHP

Since May 13Pushed 12y ago1 watchersCompare

[ Source](https://github.com/perchten/php-truepath)[ Packagist](https://packagist.org/packages/perchten/truepath)[ Docs](https://github.com/perchten/php-truepath)[ RSS](/packages/perchten-truepath/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependenciesVersions (2)Used By (0)

php-truepath
============

[](#php-truepath)

Replace PHP's extremely buggy realpath()

Usage
-----

[](#usage)

### Installation

[](#installation)

##### Via Composer

[](#via-composer)

Truepath is available on Packagist ([perchten/truepath](https://packagist.org/packages/perchten/truepath)) and as such is installable via [Composer](https://getcomposer.org/).

Add the following to your `composer.json`

```
{
	"require": {s
    	"perchten/truepath": "1.*"
    }
}

```

##### Direct include

[](#direct-include)

Clone or download from [GitHub](https://github.com/perchten/php-truepath) and include directly in your code:

```
require_once "path/to/truepath/truepath.php"

```

### Code

[](#code)

It's just one simple function, and as such it is not namespaced, but loaded as a globally available function. So just use:

```
$truepath = truepath("some/possible/path")

```

Unlike PHP's realpath, this function does not return false on error; it returns a path which is as far as it could to resolving these quirks.

This does not work on network resources including UNC and URLs. It works for the local file system only.

Acknowledgements
----------------

[](#acknowledgements)

All credit goes to [Christian](http://stackoverflow.com/users/314056/christian) from [this StackOverflow question](http://stackoverflow.com/questions/4049856/replace-phps-realpath). I'm just putting this up on some repos for easier access.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

4386d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b8f0c1a2465186a4ff26665a3b9062d5512e53cda847446e1f6040c624112fe?d=identicon)[perchten](/maintainers/perchten)

---

Top Contributors

[![builtbybrayne](https://avatars.githubusercontent.com/u/2118872?v=4)](https://github.com/builtbybrayne "builtbybrayne (8 commits)")

---

Tags

phppathrealpathtruepath

### Embed Badge

![Health badge](/badges/perchten-truepath/health.svg)

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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