Implementation of the Storj protocol for PHP
This piece of software is provided without warranty of any kind, use it at your own risk.
- Create users
- Basic authentication
- Generate ecdsa and add them
- List and delete ecdsa keys
- List and create buckets
- Ecdsa authentication
- File upload
- File download
php 5.6.0 or newer.
php-gmp needs to be installed.
Installation
Best way is to use composer
//since its still in development add it to your composer.json
"require": {
"webweave/storj-php": "dev-master"
}
Basic Code examples
Create a new user
<?php
use WebWeave\StorjPHP\BridgeClient;
// Create client for interacting with API
$client = new BridgeClient('https://api.storj.io');
// Create user
$client->createUser($email, $password);
Add a new ecdsa public key to a account
<?php
use WebWeave\StorjPHP\BridgeClient;
use WebWeave\StorjPHP\KeyPair;
// Create client for interacting with API
$client = new BridgeClient('https://api.storj.io');
// Login
$client->setBasicAuth($email, $password);
// Generate a new keypair
$keyPair = new KeyPair();
// Add it to the account
$client->addPublicKey($keyPair->getPublicKey());
Add a new bucket, and list all buckets
<?php
use WebWeave\StorjPHP\BridgeClient;
// Create client for interacting with API
$client = new BridgeClient('https://api.storj.io');
// Login
$client->setBasicAuth($email, $password);
//BucketInfo
$bucketInfo = array('name' => 'bucket_name');
// Add a new bucket
$client->createBucket($bucketInfo);
// Get all buckets
$buckets = $client->getBuckets();
//List all buckets
foreach($buckets as $bucket) {
echo $bucket->name . PHP_EOL;
echo $bucket->status . PHP_EOL;
}