New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

socialdept/atp-parity

AT Protocol record mapping and sync for Laravel Eloquent models
1,218
Install
composer require socialdept/atp-parity
Latest Version:v1.3.0
PHP:^8.3
Laravel:11 · 12 · 13
Older releases:10
License:MIT
Last Updated:Nov 7, 2026
Links: GitHub  ·  Packagist
Maintainer: socialdept

Parity Header

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.

Related Packages

poojajadav/hasmanysync

This trait can be sync data for hasmany relationship.

1,548 1
jwohlfert23/laravel-sync-relations

Package to sync nested relations from request data

7,351 0
van-ons/laravel-translations-sync

A package that synchronizes translations between your Laravel project and a prov...

4,523 0
railroad/points

A user point tracking system, which is commonly used for tracking user XP, like...

82,075 0
railroad/event-data-synchronizer

This package has reconfigured event listeners for syncing data across packages.

56,573 0

Version History

Version Released PHP Laravel License
v1.3.0 ^8.3 ^11.0|^12.0|^13.0 MIT
v1.2.0 ^8.3 ^11.0|^12.0|^13.0 MIT
v1.1.1 ^8.3 ^11.0|^12.0|^13.0 MIT
v1.1.0 ^8.3 ^11.0|^12.0|^13.0 MIT
v1.0.1 ^8.3 ^11.0|^12.0|^13.0 MIT