igorkgg/flysystem-akamai-netstorage

Akamai Netstorage filesystem adapter for Flysystem.

v3.0.2 2023-12-15 20:08 UTC

This package is auto-updated.

Last update: 2024-05-15 21:08:10 UTC


README

I created this package because official akamai package is not longer maintained by akamai and there not way to update to Flysystem >= 2.

Requirement

  • PHP: ^8.1
  • Guzzle: ^7.5
  • Monolog: ^3.0
  • Flysystem: ^3.0

Installation

$ composer require "igorkgg/flysystem-akamai-netstorage" -vvv

Usage

use League\Flysystem\Filesystem;
use League\Flysystem\AkamaiNetStorage\AkamaiNetStorageAdapter;
use League\Flysystem\AkamaiNetStorage\AkamaiNetStorageClientFactory;

...

$clientConfig = [
    'signer' => [
        'key' => 'key',
        'name' => 'keyName',
    ],
    'edgegrid' => [
        'base_uri' => 'testing.akamaihd.net.example.org',
        'timeout' => 300,
    ],
];

$cpCode = '123456';
$pathPrefix = 'working-dir';
$baseUrl = 'company.akamaihd.net.example.org';

$client = (new AkamaiNetStorageClientFactory($clientConfig))->getClient();

$adapter = new AkamaiNetStorageAdapter(
    $client,
    $cpCode,
    $pathPrefix,
    $baseUrl
);

$filesystem = new Filesystem($adapter);

$file = 'example.txt';
$filesystem->write($file, 'test content');