PHP code example of biigle / flysystem-aruna

1. Go to this page and download the library: Download biigle/flysystem-aruna library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

biigle / flysystem-aruna example snippets


use Aws\S3\S3Client;
use Biigle\Flysystem\Aruna\ArunaAdapter;
use GuzzleHttp\Client;

# Scheme: <latest or semver>.<collection name>.<project name>
$bucket = 'latest.collection-name.project-name';
$collectionId = 'MYARUNACOLLECTIONULID';

$s3Client = new S3Client([
    'credentials' => [
        'key' => 'mykey',
        'secret' => 'mysecret',
    ],
    'endpoint' => "https://{$bucket}.data.gi.aruna-storage.org",
    // Keep as-is.
    'region' => '',
    'version' => 'latest',
    'bucket_endpoint' => true,
]);

$httpClient = new Client([
    'base_uri' => 'https://api.aruna-storage.org',
    'headers' => [
        'Authorization' => 'Bearer my-aruna-token-secret',
    ],
]);

$adapter = new ArunaAdapter($s3Client, $bucket, $httpClient, $collectionId);

$exists = $adapter->fileExists('path/to/file.jpg');
var_dump($exists);
// bool(true);