PHP code example of phpactor / file-path-resolver
1. Go to this page and download the library: Download phpactor/file-path-resolver library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phpactor / file-path-resolver example snippets
$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