socialdept / atp-support
Foundational utilities for AT Protocol packages in Laravel
Requires
- php: ^8.3
- guzzlehttp/guzzle: ^7.5|^8.0
- illuminate/cache: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- phpseclib/phpseclib: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.89
- orchestra/testbench: ^9.0|^10.0|^11.0
- phpunit/phpunit: ^11.0|^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Resolve DIDs, handles, and identities for AT Protocol in Laravel.
This Laravel package holds the shared AT Protocol plumbing that atp-client, atp-schema, atp-appview and other atp-* packages build on. It resolves DIDs and handles to DID documents and PDS endpoints with caching, validates DIDs, handles and NSIDs, parses AT-URIs, finds lexicons published through DNS, checks signatures against published keys, and talks to the Microcosm services Constellation and Slingshot. To learn all about it, head over to the documentation.
Here are a few short examples of what you can do.
Resolve a handle to a DID, or any actor to its PDS:
use SocialDept\AtpSupport\Facades\Resolver; $did = Resolver::handleToDid('alice.bsky.social'); $pds = Resolver::resolvePds('alice.bsky.social');
Validate identifiers:
use SocialDept\AtpSupport\Identity; use SocialDept\AtpSupport\Nsid; Identity::isDid('did:plc:abc123'); // true Identity::isHandle('alice.bsky.social'); // true Nsid::isValid('app.bsky.feed.post'); // true
Parse an AT-URI:
use SocialDept\AtpSupport\AtUri; $uri = AtUri::parse('at://did:plc:xyz/app.bsky.feed.post/3k4abc'); $uri->collection; // app.bsky.feed.post $uri->rkey; // 3k4abc
Count the likes on a post through Constellation:
use SocialDept\AtpSupport\Facades\Microcosm; $likes = Microcosm::constellation()->getBacklinksCount( subject: 'at://did:plc:abc/app.bsky.feed.post/rk1', source: 'app.bsky.feed.like:subject.uri', );
Documentation
You'll find the documentation on https://socialde.pt/docs/atp-support.
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.