承接 lalcebo/aws-sdk-php-params 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lalcebo/aws-sdk-php-params

最新稳定版本:v0.1.2

Composer 安装命令:

composer require lalcebo/aws-sdk-php-params

包简介

Provides objects for building request parameters for AWS low-level API.

README 文档

README

Latest Version on Packagist Total Downloads Tests Workflow Style Workflow Software License

Introduction

The AWS SDK for PHP uses arrays associated with very specific structures as arguments to its methods, this leads to a great dependency on the documentation to create these arrays, what are the optional keys, their possible values, etc. This package provides objects for building request parameters for AWS low-level API.

Requirements

This package requires:

  • PHP ^7.2 | ^8.0

Installation

To get started, install the package through Composer:

composer require lalcebo/aws-sdk-php-params

Examples

# Athena
use Aws\Sdk;
use Lalcebo\Aws\Params\Athena\Actions\StartQueryExecution;
use Lalcebo\Aws\Params\Athena\DataTypes\QueryExecutionContext;
use Lalcebo\Aws\Params\Athena\DataTypes\ResultConfiguration;

try {
    $sdk = new Sdk([
        'region' => 'us-west-2',
        'version' => 'latest'
    ]);
    
    $athenaClient = $sdk->createAthena();
    
    $startQueryExecution = new StartQueryExecution(
        'SELECT * FROM tbl',
        bin2hex(random_bytes(64)),
        new QueryExecutionContext('catalogName', 'dbName'),
        new ResultConfiguration(null, 's3://athena-result-bucket/')
    );
    
    $result = $athenaClient->startQueryExecution($startQueryExecution->toArray());
    print_r($result);
} catch (Throwable $e) {
    echo $e->getMessage();
}
# DynamoDB
use Aws\Sdk;
use Lalcebo\Aws\Params\DynamoDB\Actions\CreateTable;
use Lalcebo\Aws\Params\DynamoDB\DataTypes\AttributeDefinition;
use Lalcebo\Aws\Params\DynamoDB\DataTypes\KeySchemaElement;
use Lalcebo\Aws\Params\DynamoDB\DataTypes\ProvisionedThroughput;

try {
    $sdk = new Sdk([
        'endpoint' => 'http://localhost:8000',
        'region' => 'us-west-2',
        'version' => 'latest'
    ]);
    
    $dynamodb = $sdk->createDynamoDb();
    
    $createTable = new CreateTable(
        'Music',
        [
            new AttributeDefinition('Artist', AttributeDefinition\AttributeType::STRING),
            new AttributeDefinition('SongTitle', AttributeDefinition\AttributeType::STRING),
        ],
        [
            new KeySchemaElement('Artist', KeySchemaElement\KeyType::HASH),
            new KeySchemaElement('SongTitle', KeySchemaElement\KeyType::RANGE),
        ],
        null,
        null,
        null,
        new ProvisionedThroughput(10, 5)
    );
    
    $result = $dynamodb->createTable($createTable->toArray());
    print_r($result);
} catch (Throwable $e) {
    echo $e->getMessage();
}

About

I'll try to maintain this project as simple as possible, but pull requests are welcomed!

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 11.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-30