dealnews / storage
Object Storage
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 3
pkg:composer/dealnews/storage
Requires
- php: ^8.2
- aws/aws-sdk-php: ^3.337
- dealnews/get-config: ^2.1.0
- guzzlehttp/guzzle: ^7.9
- mtdowling/jmespath.php: ^2.8
Requires (Dev)
- dealnews/test-helpers: ^2.1
- friendsofphp/php-cs-fixer: ^3.66
- php-parallel-lint/php-parallel-lint: ^1.4
- phpunit/phpunit: ^11
This package is auto-updated.
Last update: 2025-10-28 13:36:38 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
}