Skip to content

Configuration

Sahil-Gulati edited this page Oct 2, 2017 · 4 revisions

config.json

Configuration is a key for handling different modules, libraries and software. PHPHump do support for configurable options. PHPHump Configuration file should be in JSON format, Its default name is config.json.

There are number of configurable options:

1. Ignoring tags, This option will give an option to define no. of tags which are considered empty. Eg. : If we define a tag it can be any tag Lets say, <myTag> then this tag should be considered to closed, until unless defined in Ignoring tags.

"ignore":{
        "tags":{
            "starts_with": ["<myTag"]
        }
    }

2. debug_errors This option is very useful as its name suggests. This will enable debugging of errors and its value can either true or false, by default its value is true.

Note: Making it false will prevent displaying errors, which can be either helpful or destructive in production environment.

Note: Warning can be prevented with these options, which PHPHump exceptions can't be prevented.

"debug_errors" : true

3. Since 1.0.1, We have a most powerful option which can be configured is attribute_prefix. Earlier all attributes Ex: hump-loop, hump-while, hump-if etc. are static. Attribute name must be prefixed with hump now you can change this prefix with this option. Ex: Changing it default value from hump to my then hump-if etc will changed itself to my-if.

Note: Make sure its attribute prefix not a tag prefix.

"attribute_prefix" : "my"

4. deadlock_period As it name suggest, Its related to something when we got stuck at some moment. Through the processing of DOM in PHPHump we consider to handle that stuck period for 2 seconds which is by default. You can change it to any value you want, note it should be numeric. 2 seconds is the most optimized and optimal time period.

"deadlock_period" : 2

5. global_include This is another very powerful option in case when you want to execute/require/include some files which will required globally throughout the app.

"global_include":[
        "/path/to/file1.php",
        "/path/to/file2.php",
    ]

Sample configuration:

{
    "ignore":{
        "tags":{
            "starts_with": ["<hr","<br","<input"]
        }
    },
    "debug_errors":true,
    "global_include":[
        ""
    ],
    "error_variable":{
        "prefix":":",
        "postfix":":"
    },
    "attribute_prefix":"hump",
    "deadlock_period": 2
}
Clone this wiki locally