Download the PHP package jet-snowman/yii2-daemon without Composer

On this page you can find all versions of the php package jet-snowman/yii2-daemon. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yii2-daemon

Daemons

A base daemon has 3 methods:

  1. initModule()
  2. runModule()
  3. stopModule()

It's located in package jet-snowman\daemon\BaseDaemonController.

For each method you can add your logic. For example inside initModule can be initialization of some connection and in the method stopModule can be closing connection. The method runModule() executes in a loop. For development the method runs once and you don't need to stop a daemon every time. When one iteration is done a daemon updates pid file that allows to track a status of the daemon. A task inside runModule() must be light, for example if an iteration takes 1 minute it means to stop a daemon takes at least 1 minute and in case an exception you will lose your progress so a task must be small and should take less than 5 seconds to finish it.

If pid file wasn't updated for X time the Watcher will kill and start the daemon again. The watcher is always running, it monitors all daemons in the server so before to stop your daemon you have to make sure you stopped the Watcher first.

The configuration of watcher can be found here - /console/controllers/WatcherDaemonController.php

daemon - it's the name of daemon that can be found when you run ./yii

enabled - you can enable or disable some daemon

debug - if it's enabled then daemon will be ran with debug flag

kill - if it's enabled then the watcher will kill a daemon after X time

maxTime - the max time between iterations

Daemon Bin folder

The patch is ./bin. To create a runnable file you can copy some existed daemon and you need to define the following constants:

DAEMON_NAME - can be any name

DAEMON_BIN_NAME - must be taken from ./yii and the same name must be used in the watcher configuration

DAEMON_PID_NAME - can be any name but without slashes

Rabbit Base Daemon

The base class is located - jet-snowman\daemon\controllers\RabbitMQBaseDaemonController and you have the following methods

  1. initModule() - you have to set your queue name.
  2. stopModule()
  3. getChannel() - you have to return a channel
  4. handleMessage($message) - yo have to handle your task

The message is an instance of \PhpAmqpLib\Message\AMQPMessage. The handleMessage calls every time when rabbit sends a task to a worker. Only one task can be handled in one iteration.

Sqs Base Daemon


The base class is located - jet-snowman\daemon\controllers\SqsBaseDaemonController and you have the following methods

  1. initModule() - you have to set your queue name.
  2. handleMessage($message) - yo have to handle your task

The message is an instance of Array. The handleMessage calls every time when a worker gets a new response. If response has more than 1 message then it will be called multiple times for one iteration.


All versions of yii2-daemon with dependencies

PHP Build Version
Package Version
Requires yiisoft/yii2 Version *
ext-pcntl Version *
ext-posix Version *
jet-snowman/yii2-consolelog Version dev-master
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jet-snowman/yii2-daemon contains the following files

Loading the files please wait ....