https://github.com/tectiv3/libdaemon
Yet another php daemon library
https://github.com/tectiv3/libdaemon
Last synced: 6 months ago
JSON representation
Yet another php daemon library
- Host: GitHub
- URL: https://github.com/tectiv3/libdaemon
- Owner: tectiv3
- License: mit
- Created: 2016-08-22T00:22:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-22T00:30:32.000Z (almost 10 years ago)
- Last Synced: 2023-07-16T01:46:35.957Z (almost 3 years ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Yet another PHP daemon lib
Create and run php daemon with custom workers
## Installation
**Installation**
`composer require tectiv3/libdaemon`
## Define workers and run your daemon
**Define workers**
```
use Daemon\Worker;
class ExampleWorker extends Worker {
function run_cycle() {
echo "I'm a work horse!\n";
}
}
```
**Create config**
```
[default]
logfile = "daemon.log"
pidfile = "daemon.pid"
daemonize = true
worker_class = "ExampleWorker"
max_children = 2
```
**Run daemon**
```
$master = new Master('config.ini', 3600); //restart workers every hour
$master->start();
```
## Examples
Examples can be found in the `examples/` folder