PHP Client for Cloudflare API
Rulesets

Phases

Each phase of the Ruleset Engine runs one entry point ruleset, which is where your own rules for that phase live — `http_request_firewall_custom` for custom firewall rules, `http_request_transform` for URL rewrites, and so on.

Each phase of the Ruleset Engine runs one entry point ruleset, which is where your own rules for that phase live — http_request_firewall_custom for custom firewall rules, http_request_transform for URL rewrites, and so on.

Get

Fetches the latest version of the entry point ruleset for a phase.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
phasestringYesThe phase of the ruleset, e.g. `http_request_firewall_custom`.
php
$response = $client->rulesets()->phases()->get('ACCOUNT_ID', 'ZONE_ID', 'PHASE');
View this operation on the Cloudflare API Reference

Update

Updates the entry point ruleset for a phase, creating it if the phase has none yet.

The rules given replace the ones the entry point holds, so send the full set, not just the ones that changed.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
phasestringYesThe phase of the ruleset, e.g. `http_request_firewall_custom`.
valuesRuleset|arrayYesA ruleset object.
php
$response = $client->rulesets()->phases()->update('ACCOUNT_ID', 'ZONE_ID', 'PHASE', $values);
View this operation on the Cloudflare API Reference

Versions

Fetches the versions of the entry point ruleset for a phase.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
phasestringYesThe phase of the ruleset, e.g. `http_request_firewall_custom`.
php
$response = $client->rulesets()->phases()->versions('ACCOUNT_ID', 'ZONE_ID', 'PHASE');
View this operation on the Cloudflare API Reference

Version

Fetches a specific version of the entry point ruleset for a phase.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
phasestringYesThe phase of the ruleset, e.g. `http_request_firewall_custom`.
versionstringYesVersion of the ruleset.
php
$response = $client->rulesets()->phases()->version('ACCOUNT_ID', 'ZONE_ID', 'PHASE', 'VERSION');
View this operation on the Cloudflare API Reference
Copyright © 2026