Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cadyrov/yii2-daemons


https://github.com/cadyrov/yii2-daemons

Last synced: 28 days ago
JSON representation

Awesome Lists containing this project

README

        

daemons
=======
daemons on php structure

Installation
------------

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:
```