> Sourced from [kitar/laravel-dynamodb](https://github.com/kitar/laravel-dynamodb) β [MIT](https://github.com/kitar/laravel-dynamodb/blob/e8386b950703369b8f2033089e62c8a4f4f42040/CLAUDE.md). # CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Commands ### Testing - Run all tests: `./vendor/bin/phpunit` - Run a single test: `vendor/bin/phpunit tests/Path/To/TestFile.php` - Run a single test method: `vendor/bin/phpunit --filter testMethodName` ### Development - Install dependencies: `composer install` - Update dependencies: `composer update` ## Architecture Overview This is a Laravel package that provides DynamoDB integration by adapting Laravel's database layer to work with AWS DynamoDB. ### Key Design Patterns 1. **Adapter Pattern**: The package adapts Laravel's database abstractions to DynamoDB - `Connection` extends Laravel's base connection class - `Model` extends Eloquent with DynamoDB-specific behavior - Query results are processed through `Processor` to match Laravel's expectations 2. **Builder Pattern**: DynamoDB queries are constructed using a fluent interface - `Query\Builder` provides chainable methods - Separate query objects for different DynamoDB operations (filter, condition, keyCondition) - `ExpressionAttributes` manages placeholder generation for expressions 3. **Grammar Translation**: `Query\Grammar` translates Laravel-style queries to DynamoDB API format - Uses AWS Marshaler for type conversions - Compiles expressions using DynamoDB syntax - Handles reserved words and attribute name conflicts ### Important Architectural Decisions - **No Eloquent Relationships**: Models intentionally don't support relationships as DynamoDB is NoSQL - **Primary Keys**: Models require `primaryKey` and optionally `sortKey` properties - **Authentication**: Custom `AuthUserProvider` supports both primary key and API token authentication using DynamoDB indexes - **Batch Operations**: Native support for DynamoDB batch operations (batchGetItem, batchPutItem, etc.) - **Testing**: Use `dryRun()` method to inspect generated DynamoDB parameters without making API calls ### Testing Approach Tests use Mockery to mock AWS SDK calls. When writing tests: - Mock the DynamoDB client for unit tests - Use `dryRun()` to test query building without API calls - Follow existing test patterns in the `tests/` directory ### Version Compatibility - PHP: 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 - Laravel: 6.x through 12.x - AWS SDK: ^3.0
Add to your project
Paste into your project's CLAUDE.md or ~/.claude/CLAUDE.md for global rules.
More for AWS
Aphex CLAUDE.md
by @IcelandicIcecream
A modern, extensible headless CMS built with SvelteKit, featuring a portable core package, database/storage agnostic adapters, and a Sanity-inspired admin inter
Quickwit CLAUDE.md
by @quickwit-oss
Cloud-native search engine for observability. An open-source alternative to Datadog, Elasticsearch, Loki, and Tempo.
Iam Policy Validator CLAUDE.md
by @boogy
β‘ Stop IAM misconfigurations before they become breaches β Catch overprivileged permissions, dangerous wildcards, and policy errors before deployment.
Drawio Mcp CLAUDE.md
by @jgraph
CLAUDE.md for the Drawio Mcp project (JavaScript).
MCP servers for AWS
PHP MCP SDK
The official PHP SDK for Model Context Protocol servers and clients. Maintained in collaboration with The PHP Foundation.
PHP MCP Server
(PHP) - Core PHP implementation for the Model Context Protocol (MCP) server
Get the Claude Code Starter Pack
Top CLAUDE.md rules for Next.js, TypeScript, Python, Go, and React β free.
