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

Overview

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');
You might also like...
An object store for specific objects.

Object Storage A simple object storage class that will only allow "supported" objects. class MyObjectStorage extends Herrera\Util\ObjectStorage {

Quick package/plugin/component (repo) lookup for your favourite package managers
Quick package/plugin/component (repo) lookup for your favourite package managers

Package Managers (Download latest release) Package Repo Search Quick package/plugin/component (repo) lookup for your favourite package managers.

Bridge to use Symfony Messenger on AWS Lambda with Bref

Bridge to use Symfony Messenger on AWS Lambda with Bref. This bridge allows messages to be dispatched to SQS, SNS or EventBridge, while workers handle

Quick start Symfony 5 project via docker-compose

Quick Docker Symfony This repository will allow you to start a Symfony project very quickly with PostgreSQL 14, pgAdmin 4 and one of three php version

A Laravel artisan based package to create the AWS (SES + SNS) infrastructure to receive email event notifications with Http/Https endpoint.
A Laravel artisan based package to create the AWS (SES + SNS) infrastructure to receive email event notifications with Http/Https endpoint.

Laravel SES Tracking Setup the AWS infrastructure to handle email events using SES/SNS and http/s endpoints with a single Laravel artisan command. Thi

:date: The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects

sabre/vobject The VObject library allows you to easily parse and manipulate iCalendar and vCard objects using PHP. The goal of the VObject library is

Clean Code concepts adapted for PHP - A guide for producing readable, reusable, and refactorable PHP software

Clean Code concepts adapted for PHP - A guide for producing readable, reusable, and refactorable PHP software

A wrapper around symplify/config-transformer used to update recipes and using easy coding standard for generating readable config files.

Symfony Recipes Yaml to PHP Converter This is a wrapper around the symplify/config-transformer used to convert Symfony core recipes which uses .yaml c

The easiest way to match data structures like JSON/PlainText/XML against readable patterns. Sandbox:

PHP Matcher Library created for testing all kinds of JSON/XML/TXT/Scalar values against patterns. API: PHPMatcher::match($value = '{"foo": "bar"}', $p

Releases(v0.1.0)
Owner
Matthieu W.
Web developer @jolicode
Matthieu W.
YCOM Impersonate. Login as selected YCOM user πŸ§™β€β™‚οΈin frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
πŸ¦‰ human-readable regular expressions for PHP

RegExpBuilder integrates regular expressions into the programming language, thereby making them easy to read and maintain. Regular Expressions are created by using chained methods and variables such as arrays or strings.

Max Girkens 907 Dec 30, 2022
Lock library to provide serialized execution of PHP code.

Requirements | Installation | Usage | License and authors | Donations php-lock/lock This library helps executing critical code in concurrent situation

null 875 Jan 7, 2023
Deeper is a easy way to compare if 2 objects is equal based on values in these objects. This library is heavily inspired in Golang's reflect.DeepEqual().

Deeper Deeper is a easy way to compare if 2 objects is equal based on values in these objects. This library is heavily inspired in Golang's reflect.De

Joubert RedRat 4 Feb 12, 2022
Sentrifugo is a FREE and powerful Human Resource Management System (HRMS) that can be easily configured to meet your organizational needs.

Sentrifugo Sentrifugo is a free and powerful new-age Human Resource Management System that can be easily configured to adapt to your organizational pr

Sentrifugo 447 Dec 27, 2022
Igbinary is a drop in replacement for the standard php serializer.

igbinary Igbinary is a drop in replacement for the standard php serializer. Instead of the time and space consuming textual representation used by PHP

Igbinary development 727 Dec 21, 2022
Get mobile app version and other related data from Google Play Store, Apple App Store and Huawei AppGallery

Mobile App Version Get mobile app version and other related data from Google Play Store, Apple App Store and Huawei AppGallery. Installation Add to co

Omer Salaj 11 Mar 15, 2022
PHP package to make your objects strict and throw exception when you try to access or set some undefined property in your objects.

?? Yell PHP package to make your objects strict and throw exception when you try to access or set some undefined property in your objects. Requirement

Zeeshan Ahmad 20 Dec 8, 2018
Creating data transfer objects with the power of php objects. No php attributes, no reflection api, and no other under the hook work.

Super Simple DTO Creating data transfer objects with the power of php objects. No php attributes, no reflection api, and no other under the hook work.

Mohammed Manssour 8 Jun 8, 2023