evaneos / gringotts-sdk
SDK for Gringotts
Installs: 19 263
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 15
Forks: 2
Open Issues: 0
Requires
- guzzlehttp/guzzle: ^6.1
- league/flysystem: ^1.0
- ramsey/uuid: ^3.1
Requires (Dev)
- phake/phake: ^2.2
- phing/phing: ^2.13
- phpunit/phpunit: ^4.8
README
Evaneos assets storage SDK
Installation
In order to be up and running with the SDK you'll need to require it via composer
composer require evaneos/gringotts-sdk
and then create a new instance with the URL of your Gringotts instance :
$gringotts = new GringottsClient('http://your-gringotts-instance.com');
Storing an asset
Gringotts SDK allows to store assets through different forms : String, PHP resource or PSR StreamInterface and will respond with the asset id.
$gringotts = new GringottsClient('http://your-gringotts-instance.com'); $assetId = $gringotts->store('Some data as string');
You can even force your own uuid:
$assetId = $gringotts->storeWithId('871CDC92-A75B-43E7-A38E-FC22AA5450CA', 'Some data as string');
Retrieving an asset
You can retrieve a previously stored asset using the id provided while storing it. Gringotts SDK will return a stream implementing PSR StreamInterface.
$gringotts = new GringottsClient('http://your-gringotts-instance.com'); $asset = $gringotts->get('871CDC92-A75B-43E7-A38E-FC22AA5450CA');