bref / dynamap
DynamoDB object mapper
Installs: 1 361
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 4
Forks: 2
Open Issues: 2
Requires
- php: ^8.0
- ext-json: *
- aws/aws-sdk-php: ^3.130
- phpdocumentor/reflection-docblock: ^5.0
- symfony/property-info: ^4.2
Requires (Dev)
- mnapoli/hard-mode: ^0.3
- phpunit/phpunit: ^9.0
README
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.
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
ordocker-compose start
- run
phpunit