bref/dynamap

This package is abandoned and no longer maintained. No replacement package was suggested.

DynamoDB object mapper

0.4.1 2020-12-29 17:42 UTC

This package is auto-updated.

Last update: 2022-10-29 02:33:33 UTC


README

DynamoDB object mapper. Like Doctrine or Eloquent, but for DynamoDB.

Build Status Latest Version Total Downloads

This library is currently in an experimental status and is not meant to be used in production.

Installation

composer require bref/dynamap

Usage

$dynamap = Dynamap::fromOptions([
    'region' => 'us-east-1',
], $mapping);

$dynamap->save($myObject);

$myObject = $dynamap->find(MyClass::class, 'key');
$myObject = $dynamap->get(MyClass::class, 'key'); // Same as `find()` but throws an exception if not found

$objects = $dynamap->getAll(MyClass::class);

Mapping example:

$mapping = [
    Article::class => [
        'table' => 'articles',
        'keys' => [
            'id',
        ],
    ],
];

Supported field types:

  • string
  • integer
  • float
  • bool
  • DateTimeImmutable (stored as string)

Contributing

To run tests locally:

  • start DynamoDB local with docker-compose up or docker-compose start
  • run phpunit