PHP code example of eliashaeussler / gitattributes
1. Go to this page and download the library: Download eliashaeussler/gitattributes 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/ */
eliashaeussler / gitattributes example snippets
use EliasHaeussler\Gitattributes;
$parser = new Gitattributes\GitattributesParser(__DIR__);
$ruleset = $parser->parse('.gitattributes');
foreach ($ruleset->rules() as $rule) {
echo $rule->pattern()->toString().' ';
foreach ($rule->attributes() as $attribute) {
echo $attribute->toString().' ';
}
echo PHP_EOL;
}
use EliasHaeussler\Gitattributes;
$rules = [
// You can create rules in an object-oriented way
new Gitattributes\Rule\Rule(
new Gitattributes\Rule\Pattern\FilePattern('/tests'),
[
Gitattributes\Rule\Attribute\Attribute::set(Gitattributes\Rule\Attribute\AttributeName::ExportIgnore),
],
),
// ... or using a string input
Gitattributes\Rule\Rule::fromString('/phpunit.xml export-ignore'),
];
$dumper = new Gitattributes\GitattributesDumper(__DIR__);
$result = $dumper->dump('.gitattributes', $rules);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.