PHPackages                             kadokweb/path-converter - 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. kadokweb/path-converter

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

kadokweb/path-converter
=======================

Relative path converter

1.0.0(4y ago)0131MITPHPPHP &gt;=5.3.0

Since Jan 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/kadokweb/path-converter)[ Packagist](https://packagist.org/packages/kadokweb/path-converter)[ Docs](http://github.com/kadokweb/path-converter)[ RSS](/packages/kadokweb-path-converter/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (1)

Path converter
==============

[](#path-converter)

[![Build status](https://camo.githubusercontent.com/6df34cb5911e9ead1e2d042fdf0ca7a33f07b3636aafa94fc58f7da6d56bacad/68747470733a2f2f6170692e7472617669732d63692e6f72672f6b61646f6b7765622f706174682d636f6e7665727465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kadokweb/path-converter)[![Code coverage](https://camo.githubusercontent.com/784407dc89540b06d0166894fb649ef3e6b250453ddd4b5c415c851eb34ebb96/687474703a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6b61646f6b7765622f706174682d636f6e7665727465722e737667)](https://codecov.io/github/kadokweb/path-converter)[![Code quality](https://camo.githubusercontent.com/2ac7a3cff55b46db8cdf633f4c914177517d165b5d329e3715f44ae1e01012a2/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6b61646f6b7765622f706174682d636f6e7665727465722e737667)](https://scrutinizer-ci.com/g/kadokweb/path-converter)[![Latest version](https://camo.githubusercontent.com/fa71ff24c153839aca4609e9bd3c48db1283cad7228a913e369e1434a8caf8d7/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61646f6b7765622f706174682d636f6e7665727465722e737667)](https://packagist.org/packages/kadokweb/path-converter)[![Downloads total](https://camo.githubusercontent.com/5f3f76e06626a511053058a1be81cf6b68100bd14aba8fe8ac1741e5d8ef2704/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61646f6b7765622f706174682d636f6e7665727465722e737667)](https://packagist.org/packages/kadokweb/path-converter)[![License](https://camo.githubusercontent.com/f863d5bef35ab31c2edf67c767253b48016a26a35f0afcc7b160d1707104e14f/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b61646f6b7765622f706174682d636f6e7665727465722e737667)](https://github.com/kadokweb/path-converter/blob/master/LICENSE)

Usage
-----

[](#usage)

```
use KadokWeb\PathConverter\Converter;

$from = '/css/imports/icons.css';
$to = '/css/minified.css';

$converter = new Converter($from, $to);
$result = $converter->convert('../../images/icon.jpg');
// $result is now '../images/icon.jpg'
```

Methods
-------

[](#methods)

### \_\_construct($from, $to)

[](#__constructfrom-to)

The object constructor accepts 2 paths: the source path your file(s) is/are currently relative to, and the target path to convert to.

### convert($path): string

[](#convertpath-string)

$path is the relative file, which is currently relative to $from (in constructor). The return value will be the relative path of this same file, but now relative to $to (in constructor)

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

[](#installation)

Simply add a dependency on kadokweb/path-converter to your composer.json file if you use [Composer](https://getcomposer.org/) to manage the dependencies of your project:

```
composer require kadokweb/path-converter
```

```
"kadokweb/path-converter": "1.0.*"
```

Although it's recommended to use Composer, you can actually include these files anyway you want.

License
-------

[](#license)

PathConverter is [MIT](http://opensource.org/licenses/MIT) licensed.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

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

1576d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/de4d23c3027816e48288b2421b56a62287583a4f8aad03b1a5d955d7a08bd6f3?d=identicon)[kadokweb](/maintainers/kadokweb)

---

Tags

pathconverterrelativepaths

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kadokweb-path-converter/health.svg)

```
[![Health](https://phpackages.com/badges/kadokweb-path-converter/health.svg)](https://phpackages.com/packages/kadokweb-path-converter)
```

###  Alternatives

[matthiasmullie/path-converter

Relative path converter

10229.6M7](/packages/matthiasmullie-path-converter)[league/uri-components

URI components manipulation library

31932.3M66](/packages/league-uri-components)[mark-gerarts/auto-mapper-plus

An AutoMapper for PHP

5623.2M21](/packages/mark-gerarts-auto-mapper-plus)[iamcal/php-emoji

This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying them using HTML.

1.3k481.1k](/packages/iamcal-php-emoji)[ncjoes/office-converter

PHP Wrapper for LibreOffice

2431.2M4](/packages/ncjoes-office-converter)[henck/rtf-to-html

RTF to HTML converter in PHP

108785.6k1](/packages/henck-rtf-to-html)

PHPackages © 2026

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