How do I integrate Linode Object Storage in PHP


Do anyone have sample resources for integrating Linode Object Storage in php application? Some examples on creating buckets, add/update images to object storage through API would be helpful.


5 Replies


I see that you're interested in Linode's Object Storage. Can you please give more detail on how the issue relates to PHP?

In the meantime, I can provide you with sample resources that would get you started. This document provides great detail on how to use Object Storage using various methods.

Seemingly, you are interested in accessing Object Storage via the CLI. Here you can learn about configuring Linode's Object Storage CLI.

We provide some high level programmatic abstractions via our own API, but as the documentation for our own Linode API mentions, the complete storage interface is available via the industry standard S3 API.

The S3 API was originally developed by Amazon, so the the PHP library commonly used to interface with this API is called aws-sdk-php. The documentation for Ceph includes some code samples which illustrate the use of this library.

Can you provide an example of using AWSSDKforPHP with Linode Object Storage.

Will the new newer v3 AWSSDKforPHP work with linode?

For example, if use AWSSDKforPHP, what do I use for "region" or "version" and how do I use the Personal Access Token with this library?


I can confirm the latest AWS SDK for PHP works just fine with Linode Object Storage.

The region would be “eu-central-1” for Frankfurt or “us-east-1” for NJ.

For version, just pass “latest.”

For Linode, you will also need to provide the endpoint URL by passing in an additional parameter “endpoint”. This will be:

You will get an access key and secret key to use with the library.

This official documentation from AWS gives some examples:

My own PHP photo gallery, Blue Twilight uses the official AWS SDK for PHP v3, and I've recently switched to Linode Object Storage from AWS.

Here's a sample of the code from the S3 adapter to connect:

$config = [
    'credentials' => new \Aws\Credentials\Credentials(
    'version' => 'latest',
    'region' => $your_bucket_region

if (!empty($auth_url) && parse_url($auth_url) !== false)
    $config['endpoint'] = $auth_url;

$s3Client = new \Aws\S3\S3Client($config);

You could put your details within some variables, and use it like so:

$your_access_key = 'ACCESS_KEY_FROM_LINODE';
$your_secret_key = 'SECRET_KEY_FROM_LINODE';
$your_bucket_region = 'us-east-1'; // or 'eu-central-1'
$your_bucket_name = 'my-great-bucket';
$auth_url = ''; // or ''

.... code above ....

$result = $s3Client->putObject([
    'Bucket' => $your_bucket_name,
    'Key' => 'my-file-name',
    'Body' => 'this is the body!'


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct