PHP code example of dealnews / storage

1. Go to this page and download the library: Download dealnews/storage library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dealnews / storage example snippets


use DealNews\ObjectStorage\Storage;
use DealNews\ObjectStorage\Backends\S3;

// the options array for S3 can contain a profile name which will use
// GetConfig to find the other values in dealnews.ini or it can contain
// bucket, region, key, and secret.
$storage = new Storage(S3::init(['profile' => 'get_config_name']));

$object = $storage->store(
    $filename,
    'object/path/name',
    'content/type',
    [
        'meta' => 'data'
    ],
    'public' // ACL setting defaults to bucket default
);

echo json_encode($object, JSON_PRETTY_PRINT);