Client for Storj Decentralized Cloud Storage
- Storj API key or Access Grant. Obtain one from the dashboard (eu1, us1, ap1)
- PHP >= 7.4
- Any of:
- Linux x86-64 with GLIBC >=2.28
- Linux ARM64 with GLIBC >=2.28
- Windows x86-64
Other platforms or older GLIBC versions are possible. You will need to compile Uplink-C for the platform and place the shared library in the "build" folder.
- Enable the FFI in php.ini:
extension=ffi
- (optional) To use it in web request also adjust this setting from "preload" to "true":
ffi.enable=true
- Add it as a requirement to your project's composer.json to install. Run:
composer config repositories.storj/uplink composer https://raw.githubusercontent.com/storj-thirdparty/uplink-php/main/
composer require storj/uplink
For better response times of your web app, you should not use an API key every request. Instead serialize your credentials to an Access Grant:
require 'vendor/autoload.php';
$access = \Storj\Uplink\Uplink::create()->requestAccessWithPassphrase(
'[email protected]:7777',
'mybase58apikey',
'mypassphrase'
);
$serialized = $access->serialize();
echo $serialized;
If you have already used uplink-cli you can read the Access Grant from ~/.local/share/storj/uplink/config.yaml
or share it using $ uplink share
You can then use this in your web app:
$access = \Storj\Uplink\Uplink::create()->parseAccess($serialized);
- ▶ 40 second command-line demo
- ▶ Beginner website tutorial
- raw/upload.php Upload files via a HTML form
- raw/download.php Download files via the browser
- psr/FormUploadHandler.php Upload files via a HTML form in a PSR-7 framework
- psr/DownloadHandler.php Stream a PSR-7 HTTP response