Skip to content

Library for converting AWS SDK for PHP parameters and results into typed classes

License

Notifications You must be signed in to change notification settings

sunaoka/aws-sdk-php-structures

Repository files navigation

AWS SDK Structures for PHP

This is an EXPERIMENTAL library for converting AWS SDK for PHP parameters and results into typed classes.

Installation

Remove unused services and actions

This library contains a very large number of class files.

So, you can run the Sunaoka\Aws\Structures\Task\Composer::removeUnusedServices task and specify the services you want to keep in composer.json:

{
    "scripts": {
        "pre-autoload-dump": [
            "Sunaoka\\Aws\\Structures\\Task\\Composer::removeUnusedServices"
        ]
    },
    "extra": {
        "sunaoka/aws-sdk-php-structures": {
            "S3": [
                "GetObject"  // Keep S3 GetObject action
            ],
            "DynamoDb": []   // Keep DynamoDb all actions
        }
    }
}

Install

composer require sunaoka/aws-sdk-php-structures

Usage

use Aws\S3\S3Client;
use Sunaoka\Aws\Structures\S3\GetObject\GetObjectRequest;
use Sunaoka\Aws\Structures\S3\GetObject\GetObjectResponse;

// The class of the request is '<Command>Request'.
$request = new GetObjectRequest([
    'Bucket' => 'bucket',
    'Key' => 'key',
]);

$client = new S3Client();
$result = $client->getObject($request->toArray());

// The class of the result is '<Command>Response'.
$response = new GetObjectResponse($result->toArray());

echo $response->Body->getContents();

About

Library for converting AWS SDK for PHP parameters and results into typed classes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages