An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# 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.

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