Search by

socialdept / atp-orm

socialdept

Eloquent-like ORM for AT Protocol remote records in Laravel

Package info

github.com/socialdept/atp-orm

pkg:composer/socialdept/atp-orm

Statistics

Installs: 840

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.3.5 2026-06-27 06:20 UTC

This package is auto-updated.

Last update: 2026-11-07 08:39:13 UTC


README

ORM Header

Eloquent-like ORM for AT Protocol remote records in Laravel.


This Laravel package reads and writes AT Protocol records in a user's repo through classes that work like Eloquent models. A remote record class names a collection and the atp-schema DTO for it, and then lists, finds, creates, updates and deletes records on the user's PDS, with caching, cursor pagination, dirty tracking, events and backlink queries through Constellation. To learn all about it, head over to the documentation.

Here are a few short examples of what you can do. Generate a remote record class for a collection:

php artisan make:remote-record Post --collection=app.bsky.feed.post

List a user's records, by handle or DID, and page through them:

use App\Remote\Post;

$posts = Post::for('alice.bsky.social')->limit(10)->get();

foreach ($posts as $post) {
    echo $post->text;
}

$next = $posts->nextPage();

Find one record by its record key or its AT-URI:

$post = Post::for($did)->find($rkey);
$post = Post::for($did)->findByUri($uri);

Write as an authenticated account:

$post = Post::as($did)->create([
    'text' => 'Hello from ORM!',
    'createdAt' => now()->toIso8601String(),
]);

$post->update(['text' => 'Updated text']);
$post->delete();

Count and list the records that link to one:

$likes = $post->backlinks()->likes();

$likes->total();
$likes->dids();

It builds on atp-client for reads and writes, on atp-schema for record DTOs, and on atp-support for identity resolution and the Microcosm clients.

Documentation

You'll find the documentation on https://socialde.pt/docs/atp-orm.

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving it? Feel free to create an issue on GitHub.

Testing

vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see LICENSE for more information.