Using the NodeChef object storage service with the AWS S3 SDK's for PHP.

Init the S3 SDK and store an object

require 'vendor/autoload.php'; $endpoint = getenv('OSS_ENDPOINT'); $access = getenv('OSS_ACCESS_KEY'); $secret = getenv('OSS_SECRET_KEY'); $s3 = new Aws\S3\S3Client([ 'version' => 'latest', 'region' => 'us-east-1', 'endpoint' => $endpoint, 'credentials' => [ 'key' => $access, 'secret' => $secret, ], ]); $result = $s3->putObject([ 'Bucket' => 'mybucket', 'Key' => 'mykey', 'Body' => 'NodeChef loves PHP!!' ]);
After you create the Object storage service from the dashboard, every application you launch will automtically set the environment variables: OSS_ACCESS_KEY, OSS_SECRET_KEY and OSS_ENDPOINT. These variables will be used to initialize the AWS S3 SDK. You could also hardcode these values if you choose to.