socialdept / atp-parity
AT Protocol record mapping and sync for Laravel Eloquent models
Requires
- php: ^8.3
- illuminate/database: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- socialdept/atp-cbor: ^0.2
- socialdept/atp-client: ^0.1 || ^0.2 || ^0.3
- socialdept/atp-schema: ^0.4
- socialdept/atp-signals: ^2.1
- socialdept/atp-support: ^0.3
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0|^11.0
- phpunit/phpunit: ^10.0|^11.0|^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v1.3.0
- v1.2.0
- v1.1.1
- v1.1.0
- v1.0.1
- v1.0.0
- v0.6.2
- v0.6.1
- v0.6.0
- v0.5.0
- v0.4.10
- v0.4.9
- v0.4.8
- v0.4.7
- v0.4.6
- v0.4.5
- v0.4.4
- v0.4.3
- v0.4.2
- v0.4.1
- v0.4.0
- v0.3.12
- v0.3.11
- v0.3.10
- v0.3.9
- v0.3.8
- v0.3.7
- v0.3.6
- v0.3.5
- v0.3.4
- v0.3.3
- v0.3.2
- v0.3.1
- v0.3.0
- v0.2.12
- v0.2.11
- v0.2.10
- v0.2.9
- v0.2.8
- v0.2.7
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
This package is auto-updated.
Last update: 2026-11-07 08:19:23 UTC
README
Bidirectional mapping between AT Protocol records and Laravel Eloquent models.
This package maps AT Protocol records to Laravel Eloquent models and back. A mapper declares how a record and a model correspond, and the package uses it to apply firehose events and imports to your database and to write your models to their author's repo. To learn all about it, head over to the documentation.
Here are a few short examples of what you can do. Declare a mapper once for both directions:
class PostMapper extends RecordMapper { public function recordClass(): string { return \SocialDept\AtpSchema\Generated\App\Bsky\Feed\Post::class; } public function modelClass(): string { return \App\Models\Post::class; } public function fields(): array { return [ 'text' => 'content', 'createdAt' => Field::for('published_at'), ]; } public function accepts(): ?Acceptance { return Acceptance::connectedActors(); } }
Query models by their record:
Post::withAtpRecord()->get(); Post::whereAtpUri('at://did:plc:xxx/app.bsky.feed.post/abc123')->first();
Write a model to its author's repo whenever it changes, with the AutoSyncsWithAtp trait:
$post = Post::create(['content' => 'Hello!']); // Syncs to ATP $post->update(['view_count' => 41]); // No write: not in the record
Fetch a single record into a model:
$post = app(RecordHelper::class)->sync('at://did:plc:xxx/app.bsky.feed.post/abc123');
Or import everything a repo already holds:
php artisan parity:import did:plc:z72i7hdynmk6r22z27h6tvur
Documentation
You'll find the documentation on https://socialde.pt/docs/atp-parity.
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.
