PHP code example of aklump / gitignore

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

    

aklump / gitignore example snippets


$pattern = new \AKlump\GitIgnore\Pattern('foo/**/*.php');
$pattern->matches('foo/bar/baz/lorem.php') === TRUE;

$pattern = new \AKlump\GitIgnore\Pattern('settings*.php');
$pattern->toRegex() === '#^settings[^/]*\.php/?$#';

\AKlump\GitIgnore\Analyzer::containsPattern('foo/**') === TRUE
\AKlump\GitIgnore\Analyzer::containsPattern('foo/bar') === FALSE