Block-IP by API

Hi, I’m using PHP Library of Cloudflare API =>
as you can see there is not enoght documention in this github page!

I want to block an IP through API. I wrote this code:

$ip = '';
    $key = new \Cloudflare\API\Auth\APIKey('[email protected]', 'MY_API_KEY');
    $adapter = new Cloudflare\API\Adapter\Guzzle($key);
    $Rules = new \Cloudflare\API\Endpoints\user\firewall\access_rules\rules('block', [
  "target" => "ip",
  "value" => $ip
],date('Y-m-d H:i', strtotime(time())));

But it doesn’t work and returns an error that \firewall\access_rules\rules class doesn’t exist in the library.
What’s wrong with it? How to block an IP?

What did you base this code on? The error you get seems to be because you are calling a non-existent class, you most likely need AccessRules.

Hi, thanks for your reply and attention.
It’s based on some examples I’ve found here:

There wasn’t any example about blocking an IP, so I’ve changed it’s examples to block an IP based on the parameters mentioned in documentation:

Can you give me an example about how to block an IP using this official Cloudflare library?

As mentioned in my previous response you will probably have to use the AccessRules class.