Example of how to configure aws-sdk-php to use R2.
You must generate an Access Key before getting started. All examples will utilize access_key_id and access_key_secret variables which represent the Access Key ID and Secret Access Key values you generated.
This example uses version 3 of the aws-sdk-php ↗ package. You must pass in the R2 configuration credentials when instantiating your S3 service client:
Generate presigned URLs
You can also generate presigned links that can be used to share public read or write access to a bucket temporarily.
You can use the link generated by the putObject example to upload to the specified bucket and key, until the presigned link expires.