PHPackages                             tomaskraus/path-utils - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. tomaskraus/path-utils

ActiveLibrary[File &amp; Storage](/categories/file-storage)

tomaskraus/path-utils
=====================

A simple PHP library for file system paths - smart path join, root path, and so on...

0.1.0(9y ago)014MITPHPPHP ^5.3|^7.0

Since Jan 30Pushed 9y ago1 watchersCompare

[ Source](https://github.com/tomaskraus/path-utils)[ Packagist](https://packagist.org/packages/tomaskraus/path-utils)[ Docs](https://github.com/tomaskraus/path-utils)[ RSS](/packages/tomaskraus-path-utils/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

path-utils
==========

[](#path-utils)

A simple PHP library for file system paths - smart path join, root path, and so on...

features
--------

[](#features)

smart path join, fixes missing or too many path separators, joins even non-existent paths

```
Path::join("myapp/", "/dist/app.zip") );
// => "myapp/dist/app.zip"
```

application root path, with smart join

```
$pth = new Path("/var/www/myApp/");
$pth->root(); // => "/var/www/myApp"

$pth->root("conf/local.php");
// => "/var/www/myapp/conf/local.php"
```

Installation
------------

[](#installation)

Via composer:

```
composer require tomaskraus/path-utils

```

, or add this snippet to `composer.json`

```
    "require": {
        "tomaskraus/path-utils": "^0.1"
    },
```

Usage example
-------------

[](#usage-example)

Assume we have our php application in `/var/www/myApp`. A `/var/www/myApp` is our application root path.

```
