PHP code example of phine / path

1. Go to this page and download the library: Download phine/path 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/ */

    

phine / path example snippets


use Phine\Path\Path;

var_export(Path::canonical('/path/to/../canonicalize'));
// /path/canonicalize

var_export(Path::copy('/path/to/copy', '/path/to/copy/to'));
// 123 (number of files or empty directories copied)

var_export(Path::current());
// /home/user

var_export(Path::isAbsolute('/path/to/../test'));
// true

var_export(Path::isAbsolute('../test'));
// false

var_export(Path::isLocal('path/to/test'));
// true

var_export(Path::isLocal('\\windows\share'));
// false

var_export(Path::isLocal('http://example.com/'));
// false

var_export(Path::join(array('path', 'to', 'test'));
// path/to/test
// path\\to\\test

var_export(Path::remove('/path/to/recursively/remove'));
// 123 (number of paths removed)

var_export(Path::split('/path/to/test'));
// array('path', 'to', 'test')

var_export(Path::split('C:\\path\\to\\test'));
// array('C:', 'path', 'to', 'test')