PHP code example of webalternatif / flysystem-openstack-swift

1. Go to this page and download the library: Download webalternatif/flysystem-openstack-swift 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/ */

    

webalternatif / flysystem-openstack-swift example snippets


use League\Flysystem\Filesystem;
use OpenStack\OpenStack;
use Webf\Flysystem\OpenStackSwift\OpenStackSwiftAdapter;

$openstack = new OpenStack([
    'authUrl' => '{authUrl}',
    'region' => '{region}',
    'user' => [
        'id' => '{userId}',
        'password' => '{password}',
    ],
    'scope' => ['project' => ['id' => '{projectId}']],
]);

$adapter = new OpenStackSwiftAdapter($openstack, '{containerName}');

$flysystem = new Filesystem($adapter);

use Webf\Flysystem\OpenStackSwift\Config;

$flysystem->writeStream($path, $content, new Config([
    Config::OPTION_SEGMENT_SIZE => 52428800, // 50 MiB
    Config::OPTION_SEGMENT_CONTAINER => 'test_segments',
]));