webmozart/path-util
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
webmozart/assert | 1.11.0 | 19.58 kB | MIT | prod |
Webmozart/path-util, a robust, cross-platform utility, provides functions for efficiently handling and interacting with file paths and URLs. The main operations this package pertains to are normalizing, comparing, and modifying them. Being cross-platform makes this utility package widely applicable regardless of your operating system type.
To use the Webmozart/path-util package, you first need to install it via Composer by running the command composer require webmozart/path-util
. Once installed, you can use the 'Path' and 'Url' classes provided by the package to handle file paths and URLs respectively.
Here are code usage examples for the Path class:
use Webmozart\PathUtil\Path;
echo Path::canonicalize('/var/www/vhost/webmozart/../config.ini');
// => /var/www/vhost/config.ini
echo Path::getFilename('/views/index.html.twig');
// => index.html.twig
And for the Url class:
use Webmozart\PathUtil\Url;
echo Url::makeRelative('http://example.com/css/style.css', 'http://example.com/puli');
// => ../css/style.css
The documentation for the Webmozart/path-util package can be found in their GitHub repository here. The documentation provides detailed information about the functions contained within the package. It's useful for users eager to learn more about how to interact with this utility. For further information on the API, you can check out the API Docs.