cloudflare-php icon indicating copy to clipboard operation
cloudflare-php copied to clipboard

Add Get/Update Brotli setting

Open erfan-ilyas opened this issue 4 years ago • 0 comments

https://api.cloudflare.com/#zone-settings-get-brotli-setting

Add following in:

cloudflare-php/src/Endpoints/ZoneSettings.php


public function GetBrotliSetting($zoneID)
    {
        $return = $this->adapter->get(
            'zones/' . $zoneID . '/settings/brotli'
        );
        $body   = json_decode($return->getBody());

        if ($body->success) {
            return $body->result->value;
        }

        return false;
    }


public function updateBrotliSetting($zoneID, $value)
    {
        $return = $this->adapter->patch(
            'zones/' . $zoneID . '/settings/brotli',
            [
                'value' => $value,
            ]
        );
        $body   = json_decode($return->getBody());

        if ($body->success) {
            return true;
        }

        return false;
    }


Thanks

erfan-ilyas avatar Jan 17 '21 21:01 erfan-ilyas