For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
HUMAN DashboardHUMAN WebsiteRequest a Demo
Product GuidesEnforcer GuidesMobile SDKAPI ReferenceCustomer support
Product GuidesEnforcer GuidesMobile SDKAPI ReferenceCustomer support
  • General
    • About Enforcers
    • Support first-party HUMAN calls
    • Troubleshoot Enforcer configurations
  • Enforcer frameworks
    • Akamai ESI
    • Apache - C Module
    • ASP.NET
    • Callout Enforcer
    • Envoy Proxy
    • F5 BIGIP
    • Fastly JavaScript Compute@Edge
    • Google Cloud Platform (GCP) Callout Enforcer
    • Kong Plugin
    • NGINX - C Module
    • NGINX - LUA Module
    • PHP
      • What's New
      • Upgrading
      • Configuration Options
      • Advanced Configuration
      • Contributing
    • Python
    • Ruby
    • Salesforce Commerce Cloud Cartridge
LogoLogo
Login
Login
HUMAN DashboardHUMAN WebsiteRequest a Demo
On this page
  • Configuring Required Parameters
  • Required parameters:
  • Changing the Minimum Score for Blocking
  • Custom Blocking Actions
  • Examples
Enforcer frameworksPHP

Configuration Options

Was this page helpful?
Previous

Advanced Configuration

Next
Built with

Configuring Required Parameters

Configuration options are set on the $perimeterxConfig variable.

Required parameters:

  • app_id
  • cookie_key
  • auth_token
  • module_mode

All parameters are obtainable via the HUMAN Portal. (Applications and Policies pages)

Changing the Minimum Score for Blocking

Default blocking value: 100

1$perimeterxConfig = [
2 ..
3 'blocking_score' => 75
4 ..
5]

Custom Blocking Actions

In order to customize the action performed on a valid block value, use the ‘custom_block_handler’ option, and provide a user-defined function.

The custom handler should contain the action to be taken, when a visitor receives a score higher than the ‘blocking_score’ value.
A common customization option can be supplying a custom branded block page.

Default block behaviour: return an HTTP status code of 403 and serve the HUMAN block page.

1/**
2 * @param \Perimeterx\PerimeterxContext $pxCtx
3 */
4$perimeterxConfig['custom_block_handler'] = function ($pxCtx)
5{
6 $block_score = $pxCtx->getScore();
7 $block_uuid = $pxCtx->getUuid();
8
9 // user defined logic goes here
10};
11
12$px = Perimeterx::Instance($perimeterxConfig);
13$px->pxVerify();
Examples

Serving a Custom HTML Page

1/**
2 * @param \Perimeterx\PerimeterxContext $pxCtx
3 */
4$perimeterxConfig['custom_block_handler'] = function ($pxCtx)
5{
6 $block_score = $pxCtx->getScore();
7 $block_uuid = $pxCtx->getUuid();
8 $full_url = $pxCtx->getFullUrl();
9
10 $html = '<div>Access to ' . $full_url . ' has been blocked.</div> ' +
11 '<div>Block reference - ' . $block_uuid . ' </div> ' +
12 '<div>Block score - ' . $block_score . '</div>';
13
14 //echo $html;
15 header("Status: 403");
16 die();
17};
18
19$px = Perimeterx::Instance($perimeterxConfig);
20$px->pxVerify();