@@ -21,11 +21,12 @@ Watcher::create()
21
21
->addPath(__DIR__ . '/app')
22
22
->addPath(__DIR__ . '/views')
23
23
->onChange(function (EventInfo $eventInfo) {
24
- var_dump( $eventInfo->getWatchedItem()->getFullPath()) ;
24
+ echo $eventInfo->getWatchedItem()->getFullPath() . PHP_EOL ;
25
25
});
26
26
```
27
27
28
28
#### Filter
29
+
29
30
- Make sure that the file whose event is being fired should not end with provided characters.
30
31
``` php
31
32
use RTC\Watcher\Watcher;
@@ -36,7 +37,7 @@ Watcher::create()
36
37
->addPath(__DIR__ . '/app')
37
38
->fileShouldNotEndWith(['.php'])
38
39
->onChange(function (EventInfo $eventInfo) {
39
- var_dump( $eventInfo->getWatchedItem()->getFullPath()) ;
40
+ echo $eventInfo->getWatchedItem()->getFullPath() . PHP_EOL ;
40
41
});
41
42
```
42
43
@@ -50,12 +51,12 @@ Watcher::create()
50
51
->addPath(__DIR__ . '/app')
51
52
->addExtension('php')
52
53
->onChange(function (EventInfo $eventInfo) {
53
- var_dump( $eventInfo->getWatchedItem()->getFullPath()) ;
54
+ echo $eventInfo->getWatchedItem()->getFullPath() . PHP_EOL ;
54
55
});
55
56
```
56
57
57
-
58
58
#### Any-event
59
+
59
60
Listens to any event on given path
60
61
61
62
Be careful using this method.
@@ -68,12 +69,10 @@ require 'vendor/autoload.php';
68
69
Watcher::create()
69
70
->addPath(__DIR__ . '/app')
70
71
->onAny(function (EventInfo $eventInfo) {
71
- var_dump( $eventInfo->getWatchedItem()->getFullPath()) ;
72
+ echo date('H:i:s') . " - { $eventInfo->getName()} {$eventInfo-> getWatchedItem()->getFullPath()}\n" ;
72
73
});
73
74
```
74
75
75
-
76
-
77
76
#### Swoole Server Integration
78
77
79
78
``` php
0 commit comments