Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cadyrov/yii2-daemons
https://github.com/cadyrov/yii2-daemons
Last synced: 28 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cadyrov/yii2-daemons
- Owner: cadyrov
- Created: 2019-05-13T09:19:12.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-17T04:18:42.000Z (over 5 years ago)
- Last Synced: 2024-11-22T23:46:04.241Z (30 days ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
daemons
=======
daemons on php structureInstallation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist cadyrov/yii2-daemons "*"
```or add
```
"cadyrov/yii2-daemons": "*"
```to the require section of your `composer.json` file.
Install
-----Once the extension is installed, simply use it in your code by :
1. Create in you console controllers path file ObserverController.php with following content:
```
sleep);
//TODO: modify list, or get it from config, it does not matter
$daemons = [
['className' => 'OneDaemonController', 'enabled' => true],
['className' => 'AnotherDaemonController', 'enabled' => false]
];
return $daemons;
}
}
```
2. No one checks the Watcher. Watcher should run continuously. Add it to your crontab:
```
* * * * * /path/to/yii/project/yii observer-daemon --demonize=1
```
Observer can't start twice, only one instance can work in the one moment.Usage
-----
### Create new daemons
1. Create in you console controllers path file {NAME}DaemonController.php with following content:
```