PHP code example of soit / glob-webmozart-fork

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

    

soit / glob-webmozart-fork example snippets


use Webmozart\Glob\Glob;

$paths = Glob::glob('/path/to/dir/*.css'); 

use Webmozart\Glob\Iterator\GlobIterator;

$iterator = new GlobIterator('/path/to/dir/*.css');

foreach ($iterator as $path) {
    // ...
}

if (Glob::match($path, '/path/to/dir/*.css')) {
    // ...
}

$paths = Glob::filter($paths, '/path/to/dir/*.css');

use Webmozart\Glob\Iterator\GlobFilterIterator;

$iterator = new GlobFilterIterator('/path/to/dir/*.css', new ArrayIterator($paths));

foreach ($iterator as $path) {
    // ...
}

$paths = Glob::filter($paths, '/path/to/dir/*.css', Glob::FILTER_KEY);

$iterator = new GlobFilterIterator(
    '/path/to/dir/*.css', 
    new ArrayIterator($paths),
    GlobFilterIterator::FILTER_KEY
);

use Webmozart\Glob\Glob;
use Webmozart\PathUtil\Path;

// If $glob is absolute, that glob is used without modification.
// If $glob is relative, it is turned into an absolute path based on the current
// working directory.
$paths = Glob::glob(Path::makeAbsolute($glob, getcwd());

$paths = Glob::glob('/backup\\*/*.css');

$paths = Glob::glob('myscheme:///**/*.css');