You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ script.php
19
19
```php
20
20
<?php
21
21
22
-
require_once '../vendor/autoload.php';
22
+
require_once './vendor/autoload.php';
23
23
24
24
use Utopia\CLI\CLI;
25
25
use Utopia\CLI\Console;
@@ -96,6 +96,22 @@ echo $stdout; // ''
96
96
echo $stderr; // 'error'
97
97
```
98
98
99
+
### Create a Daemon
100
+
101
+
You can use the `Console::loop` command to create your PHP daemon. The `loop` method already handles CPU consumption using a configurable sleep function and calls the PHP garbage collector every 5 minutes.
102
+
103
+
```php
104
+
<?php
105
+
106
+
use Utopia\CLI\Console;
107
+
108
+
include __DIR__.'/../../vendor/autoload.php';
109
+
110
+
Console::loop(function() {
111
+
echo "Hello World\n";
112
+
}, 200000 /* 200ms */);
113
+
```
114
+
99
115
## System Requirements
100
116
101
117
Utopia Framework requires PHP 7.3 or later. We recommend using the latest PHP version whenever possible.
0 commit comments