Skip to content

PHP Path is a PHP library that provides utilities for handling file paths.

License

Notifications You must be signed in to change notification settings

okapi-web/php-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Path

License: MIT Twitter: @WalterWoshid PHP: >=8.0 Packagist Build

Coverage - PHP 8.0 Coverage - PHP 8.1 Coverage - PHP 8.2

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.

About

PHP Path is a PHP library that provides utilities for handling file paths.

Topics

Resources

License

Stars

Watchers

Forks

Languages