DynamoDB object mapper. Like Doctrine or Eloquent, but for DynamoDB.
This library is currently in an experimental status and is not meant to be used in production.
composer require bref/dynamap
$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)
To run tests locally:
- start DynamoDB local with
docker-compose up
ordocker-compose start
- run
phpunit