Download the PHP package stephanschuler/fork-job-runner without Composer

On this page you can find all versions of the php package stephanschuler/fork-job-runner. 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 fork-job-runner

Fork Job Runner

Creating child processes is expensive, especially when this comes with bootstrapping huge parts of a framework.

This package constantly holds a single PHP process at a certain bootstrap level and forks this process whenever a job is to be executed.

All the demo code blow is to be implemented by the project, it is not provided by this package.

This package does not aim for parallel processing. This might work but other libraries or frameworks like e.g. ReactPHP are way better suited for this.

The primary objective is providing a technical basis for message queues in functional tests. There is specifically the Flowpack Jobqueue Common package shipping a Fake Queue where this package is meant to help providing a replacement.

Jobs

Every code that should be run in a separate process is called a Job. Jobs are created by the parent, serialized, passed to the worker child and unserialized prior to execution. This needs to be considered, especially when dealing with database connections, file pointers and other resources.

The Job is a regular class definition. Put it in your project where it can be found by the autoloader.

Dispatching

Passing a job from the parent process to isolated execution is called dispatching. There is no routing mechanism to hand jobs to different works nor is it this packages intention to execute jobs asynchronously or in parallel.

Creating the dispatcher should be done only once because each dispatcher keeps its own worker process around.

Dispatching should be done wherever needed, e.g. within action methods in MVC controllers or in test methods of unit tests.

The Loop

The Loop is the child process waiting for the incoming Job. The Dispatcher initializes the Loop and passes Jobs along.

This is meant to be a CLI entry point. It's the "loop.php" file mentioned in the example code of the Dispatcher.

The Loop::run() method does never return unless the dispatchers command stream is open.

Responding

Jobs can respond to the dispatching process. Every serializable data can be passed from Job to Dispatcher.


All versions of fork-job-runner with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
ext-pcntl Version *
ext-posix Version *
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 stephanschuler/fork-job-runner contains the following files

Loading the files please wait ....