PHPackages                             takuya/php-relative-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. takuya/php-relative-path

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

takuya/php-relative-path
========================

calculate relative path to path

1.1(1y ago)01.2k—0%GPL-3.0-or-laterPHPCI passing

Since Jun 29Pushed 1mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (3)Versions (8)Used By (0)

php-relativePath
================

[](#php-relativepath)

Calculate a relative path to path

[![phpunit](https://github.com/takuya/php-relative-path/actions/workflows/actions.yml/badge.svg)](https://github.com/takuya/php-relative-path/actions/workflows/actions.yml)[![composer](https://github.com/takuya/php-relative-path/actions/workflows/composer.yml/badge.svg)](https://github.com/takuya/php-relative-path/actions/workflows/composer.yml)

Get the Relative path.
----------------------

[](#get-the-relative-path)

This package make you get a relative path to a target.

Equivalent to GNU realpath (Directory to Dir)
---------------------------------------------

[](#equivalent-to-gnu-realpath-directory-to-dir)

This package intended to same to GNU coreuitls `realpath --relative-to=DIR`.

`realpath` option `--relative-to=DIR` is supposed to be Relative `DIR` to `DIR`.

This package is same to GNU realpath, to calc `DIR to DIR `, not `FILE to FILE`.

Installing from github.
-----------------------

[](#installing-from-github)

```

composer config repositories.takuya/php-relative-path vcs https://github.com/takuya/php-relative-path
composer config minimum-stability dev
composer require takuya/php-relative-path

```

Installing from packagist.
--------------------------

[](#installing-from-packagist)

```
composer require takuya/php-relative-path
composer install
```

Usage example.
--------------

[](#usage-example)

This package provides a function `relative_path()` to your composer project.

```
