nkmani/netstorage-cms-api

A lightweight PHP client designed to interact with the Akamai NetStorage Usage and Configuration APIs.

Installs: 15

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/nkmani/netstorage-cms-api

v0.0.2 2026-01-28 02:05 UTC

This package is auto-updated.

Last update: 2026-01-28 02:05:55 UTC


README

Latest Version on Packagist Total Downloads License

A lightweight PHP client for interacting with the Akamai NetStorage Usage API. This package simplifies the process of managing files on Akamai NetStorage by handling authentication signatures and providing a clean interface for common operations.

Features

  • Comprehensive File Operations: Support for dir, list, stat, du, download, and delete actions.
  • Automated Authentication: Handles the generation of complex X-Akamai-ACS-Auth-Data and X-Akamai-ACS-Auth-Sign headers.
  • Guzzle Integration: Built on top of Guzzle 7 for reliable HTTP networking.
  • PSR-4 Compliant: Easy to integrate into modern PHP projects.

Installation

You can install the package via Composer:

composer require nkmani/netstorage-cms-api

Requirements

  • PHP >= 8.2
  • Guzzle HTTP Client ^7.0

Configuration

The client requires several Akamai-specific credentials. You can manage these using environment variables:

  • KEY: Your NetStorage HTTP API key.
  • CP_CODE: Your Content Provider code.
  • DOMAIN_PREFIX: The prefix for your NetStorage domain.
  • UPLOAD_ACCOUNT_ID: Your Akamai upload account ID.

Usage

Basic Setup

use NetStorage\UsageAPI\Actions;

$config = [
    "key" => 'your-api-key',
    "cpCode" => 'your-cp-code',
    "domainPrefix" => 'your-domain-prefix',
    "uploadAccountId" => 'your-upload-account-id',
];

$client = new Actions($config);

Examples

List Directory Contents

$response = $client->list(["path" => "folder_name"]);
echo $response->getBody()->getContents();

Check File Information (Stat)

$response = $client->stat(["path" => "path/to/file.txt"]);
echo $response->getBody()->getContents();

Download a File

$response = $client->download(["path" => "path/to/file.txt"]);
echo $response->getBody()->getContents();

Get Disk Usage (DU)

$response = $client->du(["path" => "folder_name"]);
echo $response->getBody()->getContents();

Development

To run tests or contribute to the package:

  1. Clone the repository.
  2. Install development dependencies: composer install.
  3. Copy .env.example to .env and fill in your credentials.