schnittstabil / finder-by-config
Create Symfony\Component\Finder instances by configuration
Installs: 924
Dependents: 4
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/schnittstabil/finder-by-config
Requires
- php: >=5.6.0
- schnittstabil/get: ^2.0 || ^3.0
- symfony/finder: ^3.0 || ^4.0
Requires (Dev)
- schnittstabil/phpunit-starter: ^6.0 || ^7.0
This package is auto-updated.
Last update: 2025-10-26 05:26:16 UTC
README
Create Symfony\Component\Finder instances by configuration
Install
$ composer require schnittstabil/finder-by-config
Usage
{
...
"require": {
"schnittstabil/finder-by-config": ...
},
"extra": {
"you/your-package": {
"simple": ["src", "tests", "composer.json"],
"extended": {
"in": ["."],
"name": ["*.php", "*.json"],
"notName": ["*Test.php"],
"size": ["> 1K"],
"exclude": ["build", "vendor"],
"ignoreDotFiles": true,
"ignoreVCS": true,
"followLinks": false,
"ignoreUnreadableDirs": false
}
}
}
}
$config = json_decode(file_get_contents('composer.json'))->extra->{'you/your-package'}; $finder = \Schnittstabil\FinderByConfig\FinderByConfig::createFinder($config->simple); $finder = \Schnittstabil\FinderByConfig\FinderByConfig::createFinder($config->extended);
Supported configuration options
For details see the Finder Component Documentation.
| Option | Type | Description |
|---|---|---|
directories |
bool |
directories only |
files |
bool |
files only |
depth |
`string | string[]` |
date |
`string | string[]` |
name |
`string | string[]` |
notName |
`string | string[]` |
contains |
`string | string[]` |
notContains |
`string | string[]` |
path |
`string | string[]` |
notPath |
`string | string[]` |
size |
`string | string[]` |
exclude |
`string | string[]` |
ignoreDotFiles |
bool |
exclude directories and files starting with a dot |
ignoreVCS |
bool |
exclude version control directories |
addVCSPattern |
`string | string[]` |
sortByName |
bool |
sorts by name |
sortByType |
bool |
sorts by type |
sortByAccessedTime |
bool |
sorts by the last accessed time |
sortByChangedTime |
bool |
sorts by the last inode changed time |
sortByModifiedTime |
bool |
sorts by the last modified time |
followLinks |
bool |
follow symlinks |
ignoreUnreadableDirs |
bool |
ignore unreadable directories |
in |
`string | string[]` |
License
MIT © Michael Mayer