Skip to content

Setting up Configuration

Chun-Sheng, Li edited this page Dec 1, 2022 · 11 revisions

With the YAML config file you can do the following things:

  • Add custom virtual variants feature
  • Add presets of extensions

Adding YAML config file

You can simply go editing the ~/.phpbrew/config.yaml and when you run phpbrew install it will load the config from the YAML config file. For example:

vim ~/.phpbrew/config.yaml

The yaml configuration file can be set by using the following command (if you have predefined YAML config file):

phpbrew init -c=config.yaml

or alternatively:

phpbrew init --config=config.yaml

The --config option copies the given yaml config file into ~/.phpbrew/config.yaml.

The YAML Configuration File

And here is the sample YAML config file:

variants:
    dev:
        bcmath:
        bz2:
        calendar:
        cli:
        ctype:
        dom:
        fileinfo:
        filter:
        ipc:
        json:
        mbregex:
        mbstring:
        mhash:
        mcrypt:
        gd:
          - --with-libdir=lib/x86_64-linux-gnu
          - --with-gd=shared
          - --enable-gd-natf
          - --with-jpeg-dir=/usr
          - --with-png-dir=/usr
extensions:
    dev:
        xhprof: latest
        xdebug: stable

To look at another full example, please refer the reply.

Custom virtual variants feature

The virtual variants are defined in the config file (see variants in the config example above) and can overwrite the default configuration of the features (see gd in the config example above), these config is only used if you call the custom virtual variant.

Presets of extensions

Similar to the virtual variants you can define virtual extensions (see extenions in the config example above). You can set also the version of the module.

The can be called by using the following command: phpbrew ext install +dev