Search by

socialdept / atp-schema

socialdept

ATProto Lexicon parser and validator with DTO generation for Laravel

Package info

github.com/socialdept/atp-schema

pkg:composer/socialdept/atp-schema

Statistics

Installs: 2 911

Dependents: 4

Suggesters: 0

Stars: 0

Open Issues: 0

v0.4.12 2026-10-18 04:00 UTC

README

Schema Header

Parse, validate, and transform AT Protocol Lexicon schemas in Laravel.


This package loads AT Protocol lexicons into a Laravel app, validates records against them, ships PHP classes for the standard AT Protocol and Bluesky lexicons, generates classes for any other lexicon, and gives you commands to create, lint and check lexicons of your own before you publish them. To learn all about it, head over to the documentation.

Here are a few short examples of what you can do. Validate a record against a lexicon:

use SocialDept\AtpSchema\Facades\Schema;

Schema::validate('app.bsky.feed.post', [
    'text' => 'Hello, AT Protocol!',
    'createdAt' => '2024-01-01T12:00:00Z',
]); // true

Build records with the bundled classes:

use SocialDept\AtpSchema\Generated\App\Bsky\Feed\Post;

$post = new Post(text: 'Hello ATP!', createdAt: now());

$post->toRecord(); // ['text' => 'Hello ATP!', 'createdAt' => '...', '$type' => 'app.bsky.feed.post']

Generate classes for any lexicon:

php artisan schema:generate app.bsky.feed.post --with-dependencies

Write lexicons of your own, and check them before you publish:

php artisan schema:new record com.example.thing
php artisan schema:lint
php artisan schema:breaking

Documentation

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

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.