PHPackages                             slava-ponomarenko/dynamodb - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. slava-ponomarenko/dynamodb

ActiveLibrary[Database &amp; ORM](/categories/database)

slava-ponomarenko/dynamodb
==========================

DynamoDb wrapper for your Laravel model and helpers

0.2.2(10y ago)023MIT

Since Aug 4Compare

[ Source](https://github.com/slava-ponomarenko/laravel-dynamodb)[ Packagist](https://packagist.org/packages/slava-ponomarenko/dynamodb)[ RSS](/packages/slava-ponomarenko-dynamodb/feed)WikiDiscussions Synced 1w ago

READMEChangelogDependencies (5)Versions (11)Used By (0)

laravel-dynamodb
================

[](#laravel-dynamodb)

Supports all key types - primary hash key and composite keys.

- [Install](#install)
- [Usage](#usage)
- [Composite Keys](#composite-keys)
- [Test](#test)
- [Requirements](#requirements)
- [Todo](#todo)
- [License](#license)
- [Author and Contributors](#author-and-contributors)

Install
-------

[](#install)

- Composer install

    ```
    composer require baopham/dynamodb:0.2.2
    ```
- Install service provider:

    ```
    // config/app.php

    'providers' => [
        ...
        BaoPham\DynamoDb\DynamoDbServiceProvider::class,
        ...
    ];
    ```
- Put DynamoDb config in `config/services.php`:

    ```
    // config/services.php
        ...
        'dynamodb' => [
            'key' => env('DYNAMODB_KEY'),
            'secret' => env('DYNAMODB_SECRET'),
            'region' => env('DYNAMODB_REGION'),
            'local_endpoint' => env('DYNAMODB_LOCAL_ENDPOINT'), // see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html
            'local' => env('DYNAMODB_LOCAL'), // true or false? should use dynamodb_local or not?
        ],
        ...
    ```

Usage
-----

[](#usage)

- Extends your model with `BaoPham\DynamoDb\DynamoDbModel`, then you can use Eloquent methods that are supported. The idea here is that you can switch back to Eloquent without changing your queries.

Supported methods:

```
// find and delete
$model->find();
$model->delete();

// Using getIterator(). If 'key' is the primary key or a global/local index and the condition is EQ, will use 'Query', otherwise 'Scan'.
$model->where('key', 'key value')->get();

// See BaoPham\DynamoDb\ComparisonOperator
$model->where(['key' => 'key value']);
// Chainable for 'AND'. 'OR' is not supported.
$model->where('foo', 'bar')
    ->where('foo2', '!=' 'bar2')
    ->get();

// Using scan operator, not too reliable since DynamoDb will only give 1MB total of data.
$model->all();

// Basically a scan but with limit of 1 item.
$model->first();

// update
$model->update($attributes);

$model = new Model();
// Define fillable attributes in your Model class.
$model->fillableAttr1 = 'foo';
$model->fillableAttr2 = 'foo';
// DynamoDb doesn't support incremented Id, so you need to use UUID for the primary key.
$model->id = 'de305d54-75b4-431b-adb2-eb6b9e546014'
$model->save();
```

- Or if you want to sync your DB table with a DynamoDb table, use trait `BaoPham\DynamoDb\ModelTrait`, it will call a `PutItem` after the model is saved.

Composite Keys
--------------

[](#composite-keys)

To use composite keys with your model:

- Set `$compositeKey` to an array of the attributes names comprising the key, e.g.

```
protected $primaryKey = ['customer_id'];
protected $compositeKey = ['customer_id', 'agent_id'];
```

- To find a record with a composite key

```
$model->find(['id1' => 'value1', 'id2' => 'value2']);
```

Test
----

[](#test)

Run:

```
$ java -Djava.library.path=./DynamoDBLocal_lib -jar dynamodb_local/DynamoDBLocal.jar --port 3000
$ ./vendor/bin/phpunit
```

- DynamoDb local version: 2015-07-16\_1.0
- DynamoDb local schema for tests created by the [DynamoDb local shell](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.Shell.html) is located [here](dynamodb_local_schema.js)

Requirements
------------

[](#requirements)

Laravel ^5.1

TODO
----

[](#todo)

- Upgrade a few legacy attributes: `AttributesToGet`, `ScanFilter`, ...

License
-------

[](#license)

MIT

Author and Contributors
-----------------------

[](#author-and-contributors)

- Bao Pham
- [warrick-loyaltycorp](https://github.com/warrick-loyaltycorp)

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~55 days

Recently: every ~41 days

Total

6

Last Release

3754d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1655889?v=4)[slava](/maintainers/slava-ponomarenko)[@slava-ponomarenko](https://github.com/slava-ponomarenko)

---

Top Contributors

[![baopham](https://avatars.githubusercontent.com/u/783410?v=4)](https://github.com/baopham "baopham (42 commits)")[![warrick-loyaltycorp](https://avatars.githubusercontent.com/u/16530482?v=4)](https://github.com/warrick-loyaltycorp "warrick-loyaltycorp (12 commits)")[![slava-ponomarenko](https://avatars.githubusercontent.com/u/1655889?v=4)](https://github.com/slava-ponomarenko "slava-ponomarenko (1 commits)")

---

Tags

laravelawsdynamodb

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slava-ponomarenko-dynamodb/health.svg)

```
[![Health](https://phpackages.com/badges/slava-ponomarenko-dynamodb/health.svg)](https://phpackages.com/packages/slava-ponomarenko-dynamodb)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M307](/packages/laravel-ai)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8723.3M27](/packages/yajra-laravel-oci8)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[baopham/dynamodb

Eloquent syntax for DynamoDB

4986.1M6](/packages/baopham-dynamodb)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
