{"id":15026770,"url":"https://github.com/dynamitephp/dynamite","last_synced_at":"2025-04-09T20:21:55.510Z","repository":{"id":48366823,"uuid":"322943519","full_name":"dynamitephp/dynamite","owner":"dynamitephp","description":"DynamoDbClient on steroids","archived":false,"fork":false,"pushed_at":"2025-03-21T22:43:54.000Z","size":174,"stargazers_count":3,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T23:28:58.344Z","etag":null,"topics":["aws","aws-dynamodb","dynamodb","php","php7","php74","php80","php81"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dynamitephp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-19T21:46:01.000Z","updated_at":"2025-03-21T22:43:28.000Z","dependencies_parsed_at":"2024-03-17T04:11:12.295Z","dependency_job_id":"95da2010-621c-4c70-8c99-272f40a39495","html_url":"https://github.com/dynamitephp/dynamite","commit_stats":{"total_commits":180,"total_committers":2,"mean_commits":90.0,"dds":0.005555555555555536,"last_synced_commit":"ee5d1cc5ba90f9b845314cef441667ef2b237720"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamitephp%2Fdynamite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamitephp%2Fdynamite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamitephp%2Fdynamite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dynamitephp%2Fdynamite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dynamitephp","download_url":"https://codeload.github.com/dynamitephp/dynamite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248104549,"owners_count":21048358,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-dynamodb","dynamodb","php","php7","php74","php80","php81"],"created_at":"2024-09-24T20:05:04.137Z","updated_at":"2025-04-09T20:21:55.471Z","avatar_url":"https://github.com/dynamitephp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamite/dynamite\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpizzaminded%2Fdynamite.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpizzaminded%2Fdynamite?ref=badge_shield)\n\n\nWork with AWS DynamoDB and Single-Table-Designed tables in your apps.\n\nRequires `aws/aws-sdk-php` with `3.*` version. \n\n## Getting started\n\n### Installation\n\n`composer require dynamite/dynamite`\n\n### Configuration\n\n## Some important things you need to know:\n\n### Your table schema\n- Dynamite assumes that there is a table with partition key and sort key created.\n- When developing locally, use [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html).\n- Dynamite assumes that tables/indexes are created and active.\n\n### You need to bring your own ID Generator\nSee `docs/bring-your-own-id.md` for more information.\n\n## The unordered roadmap to `v1.0.0`\n- [x] Creating an item\n- [ ] Document how to create an item\n- [x] Storing an item\n- [ ] Document how to store an item\n- [x] Getting item\n- [ ] Document how to get an item\n- [x] `ItemRepository`\n- [ ] Access Pattern Operations\n- [ ] Bulk operations\n- [ ] Condition Expressions\n- [ ] Unit of Work\n- [ ] Support for all operations in `SingleTableService`\n- [x] `DynamiteRegistry` to work with more than one table\n- [ ] Psalm pipeline must be green\n- [ ] PHPUnit coverage \u003e 90%\n- [ ] Support for PHP8 Attributes \n- [x] `@DuplicateTo` annotation - duplicate some attributes to additional items while putting them to DynamoDB\n- [ ] Some Console commands for Items mapping validation and project maintenance\n\n\n## Documentation\n\n### Item Duplication\n\n**Item duplication requires `dynamodb:BatchWriteItem` enabled.**\n\nWhen you need to duplicate an object to many items at once, you can use ``@DuplicateTo`` annotation:\n\n````\n/**\n * @Dynamite\\Item(objectType=\"USER\")\n * @Dynamite\\PartitionKeyFormat(\"USER#{id}\")\n * @Dynamite\\SortKeyFormat(\"USER\")\n * @Dynamite\\DuplicateTo(pk=\"UDATA#{email}\", sk=\"UDATA\", props={\"id\", \"username\"})\n * @Dynamite\\DuplicateTo(pk=\"UDATA#{username}\", sk=\"UDATA\", props={\"id\", \"email\"})\n*/\nclass User {\n    //...props\n}\n\n$user = new User('123', 'user@example.com', 'mickey')\n````\n\nIn this case, There will be 3 items sent to DynamoDB:\n- PK: `USER#123` SK:`USER` with **all** attributes defined in item;\n- PK: `UDATA#user@example` SK: `UDATA` with `id` and `username` props;  \n- PK: `UDATA#mickey` SK: `UDATA` with `id` and `email` props.\n\n\nYou can add a `transform` param to annotation to fill Primary key pair with lowercased/uppercased params:\n\n\n````\n\n//In this case PK: UDATA#MICKEY \n@Dynamite\\DuplicateTo(pk=\"UDATA#{username}\", sk=\"UDATA\", props={\"id\", \"email\"}, transform=\"UPPER\")\n\n//In this case PK: UDATA#mickey\n@Dynamite\\DuplicateTo(pk=\"UDATA#{username}\", sk=\"UDATA\", props={\"id\", \"email\"}, transform=\"LOWER\") \n````\n\nBy default params are passed as-is. `transform` works only for params injected to key, key template remains untouched.\n\n\n### Creating an Item\n\n@TODO\n\n### Annotations\n\nDynamite uses `doctrine/annotation` under the hood to parse all item annotations to provide `doctrine/orm`-like mapping configuration.\n\n#### PrimaryKeyFormat and SortKeyFormat \n\nAllows you to define the format of primary key pair of Item stored in table.\n\n**When Partition Key or Sort Key will be passed to build Partition Key or Sort Key, Dynamite will break.**\n\n```\n/**\n * Use class properties from your object wrapped with {} as a placeholders for values.\n * Warning: {itemType} will be taken from @ItemType annotation.\n * @Item(objectType=\"USER\")\n * @PartitionKeyFormat('{itemType}#{username}')\n * @SortKeyFormat('{itemType}')\n */\nclass User {\n    \n    public $email;\n    \n    public $username;\n\n}\n\n$user = new User();\n$user-\u003eusername = 'tonystark';\n//In this example, object will be stored with \"USER#tonystark\" PK and \"USER\" Sort key\n```\n\n\n### Nested items\n\nNested item is... an item nested in another item. It cannot have a Partition Key as it would be taken from parent (or first\nnon-nested item when multiple nested) object. \n\nNested item cannot have both `@Item` and `@NestedItem` annotation.\n\n\n## Ideas for future:\n- `NestedValueObjectAttribute#type should not be required when property is defined`\n\n## License \n\nMIT\n\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fpizzaminded%2Fdynamite.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fpizzaminded%2Fdynamite?ref=badge_large)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdynamitephp%2Fdynamite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdynamitephp%2Fdynamite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdynamitephp%2Fdynamite/lists"}