Download the PHP package hollodotme/fast-cgi-proxy without Composer

On this page you can find all versions of the php package hollodotme/fast-cgi-proxy. 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 fast-cgi-proxy

CircleCI Latest Stable Version Total Downloads codecov

FastCGI Proxy

Description

A proxy for distributing (a)sync requests to multiple fastCGI servers.

Installation

Usage

Request distribution

The proxy can distribute requests to multiple fastCGI servers in the following ways:

  1. Randomly
  2. Via round robin

Random distribution

To set up random distribution use the following example code:

When sending requests now the proxy will randomly choose one of the fastCGI servers to process the request.

Round robin distribution

To set up round robin distribution use the following example code:

The proxy will send your requests to the next fastCGI server in the same order they were added to the RoundRobin instance. In this example it will send to:

  1. 127.0.0.1:9001
  2. 10.100.10.42:9001,
  3. /var/run/php7.1-fpm.sock
  4. 127.0.0.1:9001 (start from the beginning again)
  5. and so on...

Sending requests

The Proxy class has the same methods as the underlying Client class for sending (a)sync requests and retrieving responses (reactively). So please consult the documentation of hollodotme/fast-cgi-client for further information.

Here is just a short list of available methods:


Cluster requests

This feature is available since v0.2.0 of this library.

In order to process a single request on a multitude of fastCGI servers, the ClusterProxy class was introduced. So in order to distribute the request to one of the configured fastCGI servers, the cluster proxy will send the same request to ALL configured fastCGI servers and allows you to read/handle their responses (reactively).

As per concept of cluster requests, there is always a one-to-many relation for request & responses. That's why the ClusterProxy class does not offer synchronous requests and reading of single responses based on a request ID.

To set up a cluster proxy, use the following example code:

The following reduced set of methods to send requests and handle responses are available in the cluster proxy class:


Cluster status

This feature is available since v0.2.0 of this library.

In order to retrieve the status of all fastCGI servers in a cluster, the method ClusterProxy#getStatus() was introduced.

Currently this method solely supports status response implementation for PHP-FPM, but can easily be extended for other fastCGI servers by implementing the interface hollodotme\FastCGI\Interfaces\ProvidesServerStatus.

Cluster status example

The following code reads the status of all 3 php-fpm containers that are part of the docker-compose setup of this library.

Please note: If the status endpoint is not enabled in the server's config (pm.status_path for PHP-FPM), the ClusterProxy#getStatus() method will throw a RuntimeException.

examples/cluster_status.php

This script produces for example the following output

Contributing

Contributions are welcome and will be fully credited. Please see the contribution guide for details.


All versions of fast-cgi-proxy with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
hollodotme/fast-cgi-client Version ~2.7.2
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 hollodotme/fast-cgi-proxy contains the following files

Loading the files please wait ....