承接 matthieuwerner/dynamodb-storable 相关项目开发

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

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

matthieuwerner/dynamodb-storable

Composer 安装命令:

composer create-project matthieuwerner/dynamodb-storable

包简介

This component, based on the Symfony serializer and async-aws, is a human-readable andquick abstraction to easily store serialized objects in DynamoDB.

README 文档

README

CI status

DynamoDB Storable

This component, based on the Symfony serializer and async-aws, is a human-readable and quick abstraction to easily store serialized objects in DynamoDB 🚀.

This storage use an existing DynamoDB table and create entries with the following structure : {"key", "namespace", "value", "class", "date""}.

Installation

composer require matthieuwerner/dynamodb-storable 

Usage

Adding service

Option 1: auto wiring (Symfony/Laravel)

use Storable\Storage;

protected function anyAction(Storage $storage): string
{
    $storage->set('key', 'value');
    // ...
}

Option 2: instantiate class

use Storable\Storage;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;

protected function anyAction(): string
{
    $encoders = [new JsonEncoder()];
    $normalizers = [new ObjectNormalizer()];
    $storage = new Storage($dynamoDbClientMock, new Serializer($normalizers, $encoders));

    $storage->set('key', 'value');
    // ...
}

Write

// String 
$storage->set('key', 'value');

// Object 
$myObject  = new MyObject();
$storage->setObject($myObject);

/!\ Working with objects need that they implement "StorableInterface"

Read

// String 
$storage->get('key'); // Return a string

// Object 
$storage->get($objectId); // Return an object

Remove

$storage->remove('key');

Working with namespaces

// Get all objects in a namespace
$storage->getByNamespace('namespace');

// Remove all objects in a namespace
$storage->removeNamespace('namespace');

Changing default values

// Change the default table name (default is "storage")
$storage->setTable('newTableName');

// Change the default namespace (default is "main")
$storage->setNamespace('newNamespaceName');

// Change the default attribute "key" in the table structure
$storage->setAttributeKey('newKeyAttribute');

// Change the default attribute "namespace" in the table structure
$storage->setAttributeNamespace('newNamespaceAttribute');

// Change the default attribute "value" in the table structure
$storage->setAttributeValue('newValueAttribute');

// Change the default attribute "class" in the table structure
$storage->setAttributeClass('newClassAttribute');

// Change the default attribute "date" in the table structure
$storage->setAttributeDate('newDateAttribute');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固