https://github.com/takuya/php-relative-path
calculate a relative path to path and create symlink relative
https://github.com/takuya/php-relative-path
path realpath relative relative-path relative-to symbloic-link symlink
Last synced: 3 months ago
JSON representation
calculate a relative path to path and create symlink relative
- Host: GitHub
- URL: https://github.com/takuya/php-relative-path
- Owner: takuya
- License: gpl-3.0
- Created: 2021-06-28T14:10:31.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-07T02:24:48.000Z (3 months ago)
- Last Synced: 2025-07-07T03:35:08.740Z (3 months ago)
- Topics: path, realpath, relative, relative-path, relative-to, symbloic-link, symlink
- Language: PHP
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-relativePath
Calculate a relative path to path
[](https://github.com/takuya/php-relative-path/actions/workflows/actions.yml)
[](https://github.com/takuya/php-relative-path/actions/workflows/composer.yml)## Get the Relative path.
This package make you get a relative path to a target.
## 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.
```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.
```sh
composer require takuya/php-relative-path
composer install
````
## Usage example.
This package provides a function `relative_path()` to your composer project.
```php
'../sites-available'
```
### example:02 file path
```php
'../sites-available/example.com'
```Notice : `relative_path` expects DIR.
## symlink( relative )
`symlink_relative` function is available.
```php