Download the PHP package kirillreutski/php-worker without Composer

On this page you can find all versions of the php package kirillreutski/php-worker. 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 php-worker

todo

  1. Rebuild status updating — not only with suspend

php-worker

Your worker class should extend \kirillreutski\PhpWorker\GenericWorker. Override methods: public static function addLog(string $text): void; public function updateStatus(string $newStatus): void; // method called each time when we need to update status in e.g. DB public function saveState(); //function called when worker finished and we need to store its data e.g. in DB

The definition of worker steps is set in constructor:

public function __construct(array $wr) {

static::$steps = [
    Step::instant('firstStep'),
    Step::instant('secondStep'),
    /* here script stops till next run*/
    Step::long('thirdStep'),
    Step::instant('forthStep')
];

parent::__construct($wr);

}

Step is an object of type kirillreutski\PhpWorker\Step; Worker class should contain a non-static funciton with the same name.

To run a worker, do: $worker = Custom\RealWorker::init([...]); $worker->run();

Also process runner implemented which picks a first task to be run: $worker = Custom\ProcessRunner::runNext(); ProcessRunner extends GenericProcessRunner and overrides public static function getProcessList (returns array of tasks)

Worker expects the following data in passed array: [ 'current_step' => CURRENT_STEP_NAME, // step from which we start 'data' => [], // data "storage" — there your steps store execution data if needed 'handling_status' => CURRENT_WORKER_STATUS, //awaitingNextRun, inProgress, done ]

Instant steps are done one by one in a single run. When worker faces 'long' step — and if it is not a first step in a current run — then it suspends. Otherwise it runs currespondent step and if this step returns true — then we go to next step; if false — suspend and step remains the same;


All versions of php-worker with dependencies

PHP Build Version
Package Version
No informations.
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 kirillreutski/php-worker contains the following files

Loading the files please wait ...