PHP Client for Cloudflare API
R2

Cors

Cors endpoint reference.

Get

Get the CORS configuration for a bucket.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
bucketNamestringYesBucket Name.
jurisdictionstring|nullNoJurisdiction where objects in this bucket are guaranteed to be stored.
php
$response = $client->r2()->cors()->get('ACCOUNT_ID', 'BUCKET_NAME', 'JURISDICTION');
View this operation on the Cloudflare API Reference

Update

Set the CORS configuration for a bucket.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
bucketNamestringYesBucket Name.
rulesarrayYesCORS rules to set on the bucket.
jurisdictionstring|nullNoJurisdiction where objects in this bucket are guaranteed to be stored.
php
$response = $client->r2()->cors()->update('ACCOUNT_ID', 'BUCKET_NAME', [], 'JURISDICTION');
View this operation on the Cloudflare API Reference

Delete

Delete the CORS configuration for a bucket.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
bucketNamestringYesBucket Name.
jurisdictionstring|nullNoJurisdiction where objects in this bucket are guaranteed to be stored.
php
$response = $client->r2()->cors()->delete('ACCOUNT_ID', 'BUCKET_NAME', 'JURISDICTION');
View this operation on the Cloudflare API Reference
Copyright © 2026