Download the PHP package cpliakas/dynamo-db-odm without Composer

On this page you can find all versions of the php package cpliakas/dynamo-db-odm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dynamo-db-odm

DynamoDB ODM

Scrutinizer Code Quality Latest Stable Version License

A lightweight, no-frills ODM (Object Document Mapper) for DynamoDB.

NOTE: This library only works with the 2.x version of the AWS SDK for PHP. The changes in the 3.x version of the SDK make it much easier to work with, and this library provides less value than before (which is a good thing, less code!). It is unclear as to whether or not a port to the 3.x SDK will be useful.

Why?

Amazon provides an SDK that connects to DynamoDB. Why would you want to use an ODM on top of it?

Installation

DynamoDB ODM can be installed with Composer by adding it as a dependency to your project's composer.json file.

Please refer to Composer's documentation for more detailed installation and usage instructions.

Usage

Defining Entities

Entities are classes that extend Cpliakas\DynamoDb\ODM\Entity and model different types of documents. Metadata, such as the table name and hash / range key attributes, are defined in static properties and accessed through the static methods defined in Cpliakas\DynamoDb\ODM\EntityInterface.

NOTE: Other ODMs use annotations to define metadata. This pattern can improve DX for applications with a large number of entities and improve performance when proper caching is implemented. However, this library intentionally chooses to use statics to define metadata since it is a lighter-weight solution for the applications this project is intended to be used in.

Initializing The Document Manager

The document manager is responsible for instantiating entity classes and reading / writing documents to DynamoDB.

CRUD Operations

Create a document.

Read, update, and delete the document.

NOTE: Other ODMs use the unit of work pattern when persisting data to the backend. Due to the nature of DynamoDB and the desire to keep this library lightweight, we opted not to use this pattern.

Composite Primary Keys

Pass an array as the primary key parameter when an entity's table uses a hash and range primary key type.

Query and Scan Commands

You can either pass the raw data structure defined by the AWS SDK for PHP as the second parameter or use the object oriented wrapper to build the search conditions. The example below uses the OO wrapper.

Attribute Transformers

Transformers convert attribute values set through the entity object to something else.

The following example builds upon the book entity above to transform \DateTime objects set as the created attribute to Unix timestamps.

Set a \DateTime object as the created attribute and create the document.

The value is stored as a Unix timestamp in DynamoDB.

Attribute Renderers

Renderers convert the value stored in DynamoDB to something that is normalized or native to PHP when it is accessed.

The following example is the opposite of the use case above. It converts the Unix timestamp stored in DynamoDB to a \DateTime object.

Add the following statement to the Book object's constructor like we did with the transformer.

Read the document from DynamoDB. Accessing the created attribute will return a \DateTime object.


All versions of dynamo-db-odm with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
aws/aws-sdk-php Version ~2.0
doctrine/cache Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cpliakas/dynamo-db-odm contains the following files

Loading the files please wait ....