myena / php-rgw-api
PHP Client for the Rados Gateway API that doesn't suck
Installs: 4 587
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 6
Forks: 4
Open Issues: 0
Requires
- php: >=7.3
- ext-curl: *
- ext-json: *
- guzzlehttp/guzzle: 7.2.*
- psr/log: 1.*
Requires (Dev)
- myena/default-logger: 1.1.*
- phpunit/phpunit: 9.3.*
- zircote/swagger-php: 3.*
Suggests
- myena/default-logger: Simple PSR-compliant logger with ANSI color support
- zircote/swagger-php: Swagger docs!
README
This lib aims to be a comprehensive PHP SDK for the Rados Gateway Admin API.
Installation
This lib is designed to be installed using Composer
{ "require": { "myena/php-rgw-api": "4.*" } }
Features
- All object-containing responses are modeled (list)
- Entire request chain is fully modeled, with required parameters being type-hinted (e.g. UserRootLink::Info)
- All models have full swagger-php markup
- Includes undocumented
/metadata
endpoints - Parameter validation (link) with hopefully useful error messages
Usage Basics
More details on each component can be found below, however here is a quick fill-in-the-blank example:
$config = new \MyENA\RGW\Config([ 'address' => '', 'adminPath' => '', 'apiKey' => '', 'apiSecret' => '', ]); $client = new \MyENA\RGW\Client($config, new \MyENA\RGW\Signature\V2Signature()); [$users, $err] = $client->Metadata()->User()->List()->execute(); if (null !== $err) { die((string)$err); } var_dump($users); // and whatever else you wanna do...
Advanced Config
You must first construct a Config:
$config = new \MyENA\RGW\Config([ 'address' => '', // REQUIRED 'apiKey' => '', // REQUIRED 'apiSecret' => '', // REQUIRED 'adminPath' => '', // optional, whatever your admin ops path is 'silent' => false // optional, silences all logging ]);
Custom Guzzle Client
The optional 2nd argument in the Config constructor accepts any object implementing the Guzzle ClientInterface. If left null, a new Guzzle Client with no options will be constructed.
Custom Logger
The optional 3rd argument in the Config constructor accepts any object implementing the Psr LoggerInterface. If left null, a new Psr NullLogger will be constructed.