PHP Client for Cloudflare API
Client Reference

Firewall Rules

Firewall Rules endpoint reference.

List

List, search, sort, and filter a zone's firewall rules.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
paramsarrayNo[]Query Parameters.
php
$response = $client->firewallRules()->list('ZONE_ID', []);
View this operation on the Cloudflare API Reference

Get

Get a single firewall rule.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
ruleIdstringYesFirewall Rule Identifier.
php
$response = $client->firewallRules()->get('ZONE_ID', 'RULE_ID');
View this operation on the Cloudflare API Reference

Create

Create one or more firewall rules.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
rulesarrayYesArray of firewall rule definitions, each referencing a filter by id (`filter: {id}`) or by inline expression (`filter: {expression}`), e.g. `[['action' => 'block', 'filter' => ['expression' => 'ip.src eq 127.0.0.1']]]`.
php
$response = $client->firewallRules()->create('ZONE_ID', []);
View this operation on the Cloudflare API Reference

Update

Update an existing firewall rule.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
ruleIdstringYesFirewall Rule Identifier.
valuesarrayYesValues to set on the firewall rule.
php
$response = $client->firewallRules()->update('ZONE_ID', 'RULE_ID', []);
View this operation on the Cloudflare API Reference

Update Priority

Update the priority of an existing firewall rule.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
ruleIdstringYesFirewall Rule Identifier.
priorityintYesThe priority of the rule, used to define the processing order. A lower number indicates a higher priority.
php
$response = $client->firewallRules()->updatePriority('ZONE_ID', 'RULE_ID', 1);
View this operation on the Cloudflare API Reference

Delete

Delete a firewall rule.

ParamTypeRequiredDefaultDescription
zoneIdstringYesZone Identifier.
ruleIdstringYesFirewall Rule Identifier.
php
$response = $client->firewallRules()->delete('ZONE_ID', 'RULE_ID');
View this operation on the Cloudflare API Reference
Copyright © 2026