Download the PHP package henderkes/fork without Composer

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

henderkes/fork

A PHP library for offloading tasks to child processes, usable during a HTTP request.

Primarily intended and tested against use in FrankenPHP. Inspired by spatie/fork and ext-parallel.

What does this solve?

ext-parallel can already offload tasks to child threads, however every thread has a fresh php runtime. This isn't a huge issue for simple scripts, however in modern frameworks like Symfony and Laravel, it creates issues because you can't use autowired services without booting up a new Kernel in each thread, or pass any non-serializable data from the parent process.

spatie/fork solves this issue, but the parent process can't do anything while children are started. This library combines ext-parallel's Runtime and Future approach with the Copy-on-Write runtime of pcntl_fork.

Other fork libraries generally only work in CLI contexts, work with stdout/stderr or don't fulfil all the requirements I personally have.

What do you need to know?

The entire runtime is forked, children and parent process share memory initially. This comes with two caveats:

Symfony integration

Lets you autowire a pre-configured Runtime for common Symfony scenarios. Currently, resets all Doctrine database connections or Symfony HttpClients for you automatically. More features may be added over time.

For your own services that hold per-process state, implement Henderkes\Fork\Symfony\ForkAwareInterface::configure(). The bundle auto-tags services with henderkes_fork.configure and calls their configure(Runtime $runtime): Runtime method on every Runtime the container autowires:

Third-party bundles can integrate without a hard dependency on this library by using the tag directly:

If you have symfony/flex enabled, just install this library and you're done. If not, manually enable it:

Laravel integration

Ships a service provider that binds Henderkes\Fork\Runtime non-shared. The bound factory registers a before(child:) hook that purges every configured DB connection in the forked child, so the next query reconnects lazily. For other resources the Laravel integration does not cover (Redis, HTTP, Elasticsearch, …), register your own hooks on the resolved Runtime:

Requirements


All versions of fork with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
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 henderkes/fork contains the following files

Loading the files please wait ...