This package is abandoned and no longer maintained. No replacement package was suggested.

Resolve files paths for your application (e.g. cache, data, etc)

0.8.3 2021-02-06 14:38 UTC

This package is auto-updated.

Last update: 2022-03-20 16:58:37 UTC



Resolves file paths by filtering and replacing tokens with values.

  • Canonicalization support via webmozart/path-util
  • XDG directory expansion via dnoegel/php-xdg-base-dir

This package can be used in, for example, a CLI application such as Phpactor to resolve application paths.


$pathResolver = new PathResolver([
    new CanonicalizationFilter(),
    new TokenExpandingFilter([
        new ValueExpander('%my_token%', 'my_value'),
        new XdgCacheExpander('%xdg_cache%'),
        new XdgConfigExpander('%xdg_conifg%'),
        new CallbackExpander('%callback%', function () {
            return 'hello from callback';

$pathResolver->resolve('/foo/../foo/%my_token%'); // foo/my_value
$pathResolver->resolve('%xdg_home%/my_app'); // /home/user/.config/my_app
$pathResolver->resolve('%callback%'); // hello from callback


This package is open source and welcomes contributions! Feel free to open a pull request on this repository.


  • Create an issue on the main Phpactor repository.
  • Join the #phpactor channel on the Slack Symfony Devs channel.