Download the PHP package malc0mn/haproxy-config-builder without Composer

On this page you can find all versions of the php package malc0mn/haproxy-config-builder. 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 haproxy-config-builder

HAProxy Config Processor

Build Status Latest Stable Version Total Downloads Latest Unstable Version License SensioLabsInsight

Install using composer

Open a shell, cd to your poject and type:

or edit composer.json and add:

Usage examples

Create from scratch
Read from file

Output ordering

Keywords ordering within a proxy block

By default, the builder output will be printed in the same order you have added parameters. This is not always desired, especially when working with ACLs that you want to be present in the output before you set the use_backend calls.

To solve this issue, you can use the setParameterOrder() method to indicate the desired printing order. An example:

Ordering of proxy blocks in the config file

The proxy blocks will be rendered according to their given priority with some limitations:

  1. global will always be rendered first (1st).
  2. defaults will always be rendered second (2nd).
  3. resolvers will always be rendered third (3rd).
  4. userlist will always be rendered fourth (4th).
  5. Attempting to set a print priority on defaults will throw an exception.

You can thus only control the print priority of backend, frontend and listen proxy blocks. The default priority is set to 1000. You can change the priority by calling the setPrintPriority() method on the desired proxy block: a smaller integer means a higher priority!

Now what?

Once you have the config, you can use the various helper methods to programatically alter or update the config. Or you can use those helpers to conditionally add or remove settings...

Have a look at the classes to see what is at your disposal. A peek at the tests will give you a very good idea of what you can do with all available methods.

More complex stuff

If you need more complex rules that need multiple use_backend calls to the same backend, then you can use tagged backends.

Consider this HAProxy frontend proxy block:

This example uses path mappings to direct traffic to a different backend. It should be obvious that you cannot write this to achieve the same:

The above example will never redirect you to the API backend when calling the website.example.com/api url because the first use_backend statement will:

  1. see that the host is website.example.com and the path is not /admin so it will go on to the next condition
  2. see that the host is website.example.com and redirect you to the website backend.

To recreate the first, correct, example using this library, you can use tagged backends:

Credits

The concepts used are based on the Nginx Configuration processor by romanpitak.


All versions of haproxy-config-builder with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 malc0mn/haproxy-config-builder contains the following files

Loading the files please wait ....