PHP code example of nelwhix / filepath
1. Go to this page and download the library: Download nelwhix/filepath 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/ */
nelwhix / filepath example snippets
$routes =
$url = \Nelwhix\Filepath\Filepath::join(__DIR__, 'src', 'routes.php');
$routes =
\Nelwhix\Filepath\Filepath::base("/foo/bar/baz.js");
// this will return "baz.js"
\Nelwhix\Filepath\Filepath::abs("Filepath.php");
// this returns "\C:\Users\USER PC\Documents\Open Source contributions\filepath\src\Filepath.php"
\Nelwhix\Filepath\Filepath::dir("/foo/bar/baz.js")
// returns "/foo/bar"
\Nelwhix\Filepath\Filepath::clean("//dirty///path////");
// this returns /dirty/path
\Nelwhix\Filepath\Filepath::ext("/src/routes.php");
// returns ".php"
$split = \Nelwhix\Filepath\Filepath::split("./Documents/side-projects/filepath/composer.json");
$split->dir; // ./Documents/side-projects/filepath
$split->file; // composer.json
Filepath::walk("C:\Users\USER PC\Documents\\300L books", function (\DirectoryIterator $param) {
if($param->isDot()) return;
echo $param->getFilename() . "\n";
});
Nelwhix\Filepath\Filepath::glob(".php", "side-projects/src");
// returns an array containing the files matching the pattern