PHP Client for Cloudflare API
R2

Lifecycle

Lifecycle endpoint reference.

Get

Get the lifecycle 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()->lifecycle()->get('ACCOUNT_ID', 'BUCKET_NAME', 'JURISDICTION');
View this operation on the Cloudflare API Reference

Update

Set the lifecycle configuration for a bucket.

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