1
1
Nette Finder: Files Searching
2
2
=============================
3
3
4
- [ ![ Downloads this Month] ( https://img.shields.io/packagist/dm/nette/finder.svg )] ( https://packagist.org/packages/nette/finder )
5
- [ ![ Tests] ( https://github.com/nette/finder/workflows/Tests/badge.svg?branch=master )] ( https://github.com/nette/finder/actions )
6
- [ ![ Coverage Status] ( https://coveralls.io/repos/github/nette/finder/badge.svg?branch=master )] ( https://coveralls.io/github/nette/finder?branch=master )
7
- [ ![ Latest Stable Version] ( https://poser.pugx.org/nette/finder/v/stable )] ( https://github.com/nette/finder/releases )
8
- [ ![ License] ( https://img.shields.io/badge/license-New%20BSD-blue.svg )] ( https://github.com/nette/finder/blob/master/license.md )
9
-
10
-
11
- Introduction
12
- ------------
13
-
14
4
Nette Finder makes browsing the directory structure really easy.
15
5
16
6
Documentation can be found on the [ website] ( https://doc.nette.org/finder ) .
17
7
8
+ ** The library has been moved to the [ nette/utils] ( https://github.com/nette/utils ) **
9
+
18
10
19
11
[ Support Me] ( https://github.com/sponsors/dg )
20
12
--------------------------------------------
@@ -30,7 +22,7 @@ Installation
30
22
------------
31
23
32
24
``` shell
33
- composer require nette/finder
25
+ composer require nette/utils
34
26
```
35
27
36
28
All examples assume the following class alias is defined:
@@ -48,11 +40,11 @@ How to find all `*.txt` files in `$dir` directory and all its subdirectories?
48
40
``` php
49
41
foreach (Finder::findFiles('*.txt')->from($dir) as $key => $file) {
50
42
// $key is a string containing absolute filename with path
51
- // $file is an instance of SplFileInfo
43
+ // $file is an instance of Nette\Utils\FileInfo
52
44
}
53
45
```
54
46
55
- The files in the ` $file ` variable are instances of the ` SplFileInfo ` class.
47
+ The files in the ` $file ` variable are instances of the ` Nette\Utils\FileInfo ` class.
56
48
57
49
If the directory does not exist, an ` Nette\UnexpectedValueException ` is thrown.
58
50
@@ -113,7 +105,7 @@ Finder::findFiles('*.txt')
113
105
->exclude('*X*')
114
106
```
115
107
116
- If ` exclude() ` is specified ** after ** ` from() ` , it applies to crawled subdirectories:
108
+ And use ` exclude() ` to skip crawled subdirectories:
117
109
118
110
``` php
119
111
Finder::findFiles('*.php')
@@ -148,7 +140,7 @@ Both functions understand the operators `>`, `>=`, `<`, `<=`, `=`, `!=`.
148
140
Here we traverse PHP files with number of lines greater than 1000. As a filter we use a custom callback:
149
141
150
142
``` php
151
- $hasMoreThan100Lines = function (SplFileInfo $file): bool {
143
+ $hasMoreThan100Lines = function (FileInfo $file): bool {
152
144
return count(file($file->getPathname())) > 1000;
153
145
};
154
146
0 commit comments