PHP Classes
elePHPant
Icontem

File: samples/basic.php

Recommend this page to a friend!
  Classes of Joseluis Laso  >  PHP AWS S3 SDK Wrapper  >  samples/basic.php  >  Download  
File: samples/basic.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP AWS S3 SDK Wrapper
Retrieve and cache AWS S3 files using the SDK
Author: By
Last change:
Date: 4 years ago
Size: 409 bytes
 

 

Contents

Class file image Download
<?php

include_once __DIR__."/../vendor/autoload.php";

$cache = dirname(__DIR__)."/cache/";
$remoteFile = "test1/test1.txt";

$s3 = \JLaso\S3Wrapper\S3Wrapper::getInstance();

var_dump($s3->listBuckets());

$s3->saveFile($remoteFile, "text1");

var_dump($s3->getFilesList());

$f1 = $s3->getFileIfNewest($cache."test1.txt", $remoteFile);

var_dump(file_get_contents($f1));

$s3->deleteFile($f1, $remoteFile);