PHP code example of hail / path

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

    

hail / path example snippets


use Hail\Path\{Path, BasePath};

$paths = new Path([
    'root' => __DIR__,
    'storage' => __DIR__ .  '/storage',
]);

$paths->root instanceof BasePath; // true
$paths->root->base() === $paths->root(); // true
$paths->root->absolute('a', 'b') === $paths->root('a', 'b'); // true

$paths->storage instanceof BasePath; // true
$paths->storage->base() === $paths->root('storage'); // true
$paths->root->relative($paths->storage()) === 'storage'; // true