Firewall package

Maintainers

👁 turbo124

Package info

github.com/turbo124/waf

pkg:composer/turbo124/waf

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

v1.0.0 2024-03-28 21:24 UTC

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT e38ac640774254a5b97c18ef90ec75710525f111

  • David Bomba <turbo124.woop@gmail.com>

This package is auto-updated.

Last update: 2026-06-16 09:52:36 UTC


README

A wrapper over the Cloudflare WAF.

Stop threats at the network edge, not at your application.

Ban IP addresses at the network edge

Initialize the Cloudflare WAF

$zone = The Cloudflare Zone ID
$account_id = The Cloudflare Account ID;
$email = The email address associated with the cloudflare account;
$api_key = The cloudflare API key (must have permissions with write Zone Rulesets and Rules);

Init the WAF

$waf = new \Turbo124\Waf\Waf($api_key, $email, $zone, $account_id);

Ban a IP address

$waf->unbanIp('103.15.248.112');

Unban a IP Address

$waf->unbanIp('103.15.248.112');

Ban a ASN

$waf->banAsn('10343');

UnBan a ASN

$waf->unbanAsn('10343');

Ban a country by their ISO 3166 2 country code

$waf->banCountry('DE');

UnBan a country by their ISO 3166 2 country code

$waf->unbanCountry('DE');

Managed challenge a IP Address

$waf->challengeIp('103.15.248.112');

Disable managed challenge on a IP Address

$waf->unchallengeIp('103.15.248.112');

Bonus intelligence helpers.

Cloudflare providers some nifty intelligence metrics on certain domains and IP addresses and can provide risk ratings

Get Domain Information

$waf->meta->getDomainInfo('example.com');

Response

[
 "domain" => "puabook.com",
 "ip" => "51.254.35.55",
 "risk_type_string" => "Parked & For Sale Domains,Security Risks",
 "risk_type" => [
 [
 "id" => 128,
 "super_category_id" => 32,
 "name" => "Parked & For Sale Domains",
 ],
 [
 "id" => 32,
 "name" => "Security Risks",
 ],
 ],
 "content_catgories" => [],
 "content_category_string" => "",
]

Get IP Information

$waf->meta->getIpInfo('210.140.43.55');

Response

[
 "ip" => "210.140.43.55",
 "asn" => 4694,
 "country" => "JP",
 "risk_types" => [],
]