Download the PHP package tbessenreither/quickfork without Composer

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

Quickfork

This is a lightweight wrapper for PCNTL that adds Inter Process Communication (IPC) via Unix Sockets and a simple API for running tasks in parallel. It is designed to be easy to use and to integrate into existing projects.

Features

Installation

You can install Quickfork via Composer.

Usage

Threadded Tasks with worker pool

The main use case of Quickfork is to run Tasks in parallel with a fixed pool of worker processes.

This example command will create 4 tasks that will be run on a maximum of 5 worker threads. Each task will execute the workerThread method, which simulates some work and returns a string. One of the tasks will throw an exception to demonstrate error handling.

If there are more threads than tasks only one thread per task will be created, so in this example only 4 threads will be created. If you have more tasks than threads, the tasks will be queued and executed as soon as a thread is available.

This will print something like this:

Running a Task with bidirectional IPC

This is a more niche use case, but it shows how to setup and use the IPC feature of Quickfork. We create a single task that will run the taskHandler method. Then the following steps will happen:

  1. The Quickfork process will trigger the fork_start message, which will be printed out by the parent process.
  2. The taskHandler will send a message with the topic ready_for_task to the parent process.
  3. The parent process will receive the ready_for_task message and send a new message with the topic new_task and some random numbers to sum up.
  4. The taskHandler will receive the message, calculate the sum and then
    • send a message with the topic thread_result back to the parent process.
    • The taskHandler will then send another message with the topic ready_for_task to indicate that it is ready for another task.
  5. The parent process will receive the result and print it out.
  6. The steps 3-5 will repeat until the parent process has sent out 5 tasks, then it will send a message with the topic shutdown to the worker thread.
  7. The taskHandler will receive the shutdown message and exit the loop.
    • This will cause Quickfork to trigger the fork_output, fork_result and fork_complete messages, which will be printed out by the parent process.

This will print something like this:


All versions of quickfork with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
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 tbessenreither/quickfork contains the following files

Loading the files please wait ...