norbybaru/laravel-aws-timestream
Integrates AWS Timestream, Amazon's serverless time-series database, into Laravel. Provides an Eloquent-style model and fluent query builder so you can write, query, and manage time-series data using familiar Laravel conventions, with connection and credential configuration handled by the package.
The package is a thin, Eloquent-flavoured wrapper around the AWS Timestream SDK. You get a Model base class, a query builder, and a config-driven connection to a single Timestream database. It is not a full Eloquent replacement — treat it as a structured client, not an ORM.
Minimal setup:
composer require norbybaru/laravel-aws-timestream (v1.0.0 requires Laravel 10/11/12 and PHP 8.2+).php artisan vendor:publish --tag=timestream-config (or the service-provider tag — check the README for the exact tag). This drops config/timestream.php.AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION, plus the Timestream database name (AWS_TIMESTREAM_DATABASE / the key in the published config). If you're on IAM roles / ECS / Lambda, omit the key pair and let the SDK resolve credentials.timestream:create-table, see the README), but the database itself is usually provisioned via console/CLI/IaC.namespace App\Models;
use NorbyBaru\AwsTimestream\Models\Model;
class PageView extends Model
{
protected $table = 'page_views';
}
PageView::create([...]) and PageView::query()->where(...)->get(). Confirm the exact dimension/measure keys against the README — the shape is Timestream-native (dimensions, measures, time, version), not your usual Eloquent columns.First useful use case: application telemetry — page views, request durations, queue job timings, or IoT-style metrics — where you want an Eloquent-ish API without paying for a separate time-series service.
Model = table. Each model maps to one Timestream table via $table. Keep models small; don't try to share a model across tables.
Respect the dimensions/measures split. Dimensions are indexed and filterable (low cardinality: user_id, route, status); measures are the payload (duration_ms, bytes). Put anything you'll WHERE on into dimensions, and anything you'll SELECT/aggregate into measures.
Write paths.
WriteRecords call limit. Chunk with collect($rows)->chunk(100) and dispatch to a queue.retryUntil / tries and handle ThrottlingException with backoff.Query patterns.
->where('time', '>=', ...)) — Timestream bills on bytes scanned, and unbounded scans get expensive fast.first() / get() for reads; use raw Timestream SQL only through the underlying client when the builder can't express an aggregation.Testing.
Integration tips.
App\Models\Timestream\...) so they're visually distinct from Eloquent models.^0.4. If you're upgrading to v1.0.0, audit for anything relying on illuminate/* ^9 constraints across your dependency tree, not just this package.^1.0 and read the changelog on each minor.timestream:DescribeEndpoints (easy to forget — it's called on every client init), timestream:WriteRecords, timestream:Select, and timestream:CreateTable if you use the artisan command. A minimal timestream:* policy is tempting but too broad; scope it.DescribeEndpoints. If AWS_DEFAULT_REGION is unset or wrong, you get confusing "endpoint not found" errors rather than auth errors.OR in dimension predicates, and hard limits on dimensions per record (~20) and result size. If you need relational behaviour, aggregate in Timestream and join in your app.SELECT lists, filter aggressively on dimensions and time, and avoid SELECT * on wide tables. A runaway dashboard can cost real money.php artisan config:cache will freeze your env values. If you rotate AWS credentials or change the database name, run config:clear and redeploy.nunomaduro/larastan constraint to ^1|^2|^3, so static analysis should work across Laravel 10/11/12 — if you were suppressing errors because of the old constraint, re-run PHPStan and drop the ignores.WritesMetrics) rather than copy-pasting dimension/measure arrays around. If you need multi-database or a non-default client, bind your own client instance in a service provider and inject it.vendor:publish diff on config/timestream.php, run your test suite against the mocked client, and validate a single write + read against a staging Timestream database before rolling to production.How can I help you explore Laravel packages today?