okapi / path
PHP Path is a PHP library that provides utilities for handling file paths.
Installs: 4 491
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: >=8.0
Requires (Dev)
- phpunit/phpunit: >=9.0
This package is auto-updated.
Last update: 2024-12-18 16:02:08 UTC
README
PHP Path
PHP Path is a PHP library that provides utilities for handling file paths.
It is based on Node.js's path module.
Installation
composer require okapi/path
Usage
<?php use Okapi\Path\Path; // Resolve $path = Path::resolve('./path/to/file.txt'); // --> /project/path/to/file.txt $path = Path::resolve([ './path/to/file.txt', '../project2/file.txt', ]); // [0] --> /project/path/to/file.txt // [1] --> /project2/file.txt // Join $path = Path::join('/project', 'path', 'to', 'file.txt'); // --> /project/path/to/file.txt
Testing
- Run
composer run-script test
or - Run
composer run-script test-coverage
Show your support
Give a ⭐ if this project helped you!
📝 License
Copyright © 2023 Valentin Wotschel.
This project is MIT licensed.