dealnews/storage

There is no license information available for the latest version (2.1.0) of this package.

Object Storage

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 1

pkg:composer/dealnews/storage

2.1.0 2025-10-01 00:25 UTC

This package is auto-updated.

Last update: 2025-10-09 13:34:48 UTC


README

This library provides an interface to store and retrieve objects from services such as S3.

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 config.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);

A DealNews\ObjectStorage\Data\StorageObject object is returned from the get, head, and store methods. Both the store and head methods will not return the object's body in the object_data property. The get method will fill the object_data property with the object's body. The delete method returns a boolean.

{
    "object_storage_id": "QpFqF6v0BO7dhvNPVZO46t5by5lCRrlciL7GH8Quvc0vADZt/UU5zKCu2dHfibdIC33jb2p+fVs=",
    "container": "bucket_name",
    "key": "object/path/name",
    "url_path": "/bucket_name/object/path/name",
    "storage_url": "s3://bucket_name/object/path/name",
    "content_type": "text/plain",
    "meta_data": {
        "Meta": "data"
    },
    "last_modified": "Fri, 13 Aug 2021 21:27:47 GMT",
    "object_data": null
}