PHP code example of webmozart / glob

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

    

webmozart / glob 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;

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

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

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