Download the PHP package socialdept/atp-support without Composer
On this page you can find all versions of the php package socialdept/atp-support. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download socialdept/atp-support
More information about socialdept/atp-support
Files in socialdept/atp-support
Package atp-support
Short Description Foundational utilities for AT Protocol packages in Laravel
License MIT
Informations about the package atp-support
ATP Support
Resolve DIDs, handles, and identities for AT Protocol in Laravel.
What is ATP Support?
ATP Support is the foundational Laravel package for the SocialDept AT Protocol ecosystem. It provides DID and handle resolution, identity validation, AT-URI parsing, NSID utilities, and shared configuration used by all other atp-* packages.
If you're building anything on AT Protocol with Laravel, this is your starting point.
Why use ATP Support?
- Identity resolution - Resolve DIDs, handles, and PDS endpoints with intelligent caching
- Validation utilities - Validate DIDs, handles, and NSIDs with battle-tested logic
- AT-URI parsing - Parse and create
at://URIs as immutable value objects - Shared configuration - Common AT Protocol settings (PLC directory, PDS endpoint, public API) in one place
- Extensible resolvers - Pluggable DID method resolvers with support for
did:plcanddid:web - DNS lexicon resolution - Discover lexicon schemas via DNS TXT records
- Microcosm integration - Backlink discovery via Constellation and fast record caching via Slingshot
Quick Example
Installation
Publish the configuration:
Configuration
All shared AT Protocol settings live in config/atp-support.php:
Resolution often runs while a user waits, for example verifying a service auth token or starting a login. timeout bounds a whole request and connect_timeout bounds connecting, so an unreachable host fails in two seconds rather than holding the request. Both apply to every DID and handle resolver and, for connecting, to the Microcosm clients.
Other atp-* packages read shared values like public_api directly from this config.
Usage
Resolving Identities
The Resolver facade is the main entry point for all resolution operations:
Caching
All resolutions are cached by default with configurable TTLs. You can bypass or clear the cache:
Validating Identities
The Identity class provides static validation methods:
Parsing AT-URIs
The AtUri value object parses the at:// URI format used throughout AT Protocol:
Working with NSIDs
Namespace Identifiers are the reversed-domain notation used for AT Protocol collections and methods:
DNS Lexicon Resolution
Discover lexicon schemas published via DNS TXT records:
fetch() and fetchFrom() answer null for a lexicon that is not published, and throw LexiconResolutionException when the authority cannot be read: its DID names no PDS, the PDS is down, or it returns something that is not a schema. Keep the two apart before acting on a missing schema.
Resolution is not hierarchical. Each authority needs its own TXT record, so com.example.feed.post is looked up at _lexicon.feed.example.com and is not covered by com.example's. Pass a dnsLookup callable to the constructor to replace dns_get_record in tests.
Microcosm
Microcosm.blue provides protocol-level content discovery APIs for AT Protocol. ATP Support includes HTTP clients for two Microcosm services:
- Constellation - Backlink indexing: find all records that link to a given subject
- Slingshot - Fast record and identity caching
Constellation (Backlinks)
The source parameter uses collection:path format, where the path is the dot-notation location of the linking field within the record.
Slingshot (Record Cache)
Errors
Both clients throw MicrocosmException. When the service answered with an XRPC error, error names it and status is the HTTP status, so a missing record is told apart from a service that is down:
Microcosm Facade
Access both clients through a single facade:
Microcosm Configuration
Add these environment variables to customize endpoints:
Custom DID Resolvers
Register custom resolvers for additional DID methods:
API Reference
Facade Methods
| Method | Description |
|---|---|
Resolver::resolveDid($did) |
Resolve DID to DidDocument |
Resolver::handleToDid($handle) |
Convert handle to DID string |
Resolver::resolveHandle($handle) |
Resolve handle to DidDocument |
Resolver::resolveIdentity($actor) |
Auto-detect and resolve DID or handle |
Resolver::resolvePds($actor) |
Get PDS endpoint for DID or handle |
Resolver::clearDidCache($did) |
Clear cached DID data |
Resolver::clearHandleCache($handle) |
Clear cached handle data |
Resolver::clearPdsCache($actor) |
Clear cached PDS data |
Resolver::clearCache() |
Clear all cached data |
Value Objects
| Class | Description |
|---|---|
AtUri |
Immutable AT-URI parser (at://did/collection/rkey) |
Nsid |
Immutable Namespace Identifier |
DidDocument |
Resolved DID Document with PDS and handle access |
Microcosm
| Class | Description |
|---|---|
ConstellationClient |
Backlink discovery and link counting via Constellation |
SlingshotClient |
Fast record and identity resolution via Slingshot |
Microcosm |
Service class wrapping both clients |
BacklinkReference |
Data object: did, collection, rkey, uri() |
GetBacklinksResponse |
Data object: total, records, cursor |
GetRecordResponse |
Data object: uri, cid, value |
MiniDoc |
Data object: did, handle, pds, signingKey |
LinkSummary |
Data object: links, forCollection(), total() |
MicrocosmException |
Exception for Microcosm request failures |
Validation
| Method | Description |
|---|---|
Identity::isDid($value) |
Validate DID format |
Identity::isHandle($value) |
Validate handle format |
Identity::isPlcDid($did) |
Check for did:plc method |
Identity::isWebDid($did) |
Check for did:web method |
Identity::extractDidMethod($did) |
Get method from DID string |
Nsid::isValid($nsid) |
Validate NSID format |
Exceptions
| Exception | Description |
|---|---|
ResolverException |
Base exception for all resolution errors |
DidResolutionException |
DID resolution failures |
HandleResolutionException |
Handle resolution failures |
Requirements
- PHP 8.2+
- Laravel 11+
Resources
Support & Contributing
Found a bug or have a feature request? Open an issue.
Want to contribute? We'd love your help! Check out the contribution guidelines.
Credits
- Miguel Batres - founder & lead maintainer
- All contributors
License
ATP Support is open-source software licensed under the MIT license.
Built for the Atmosphere • By Social Dept.
All versions of atp-support with dependencies
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/cache Version ^11.0|^12.0|^13.0
guzzlehttp/guzzle Version ^7.5|^8.0
phpseclib/phpseclib Version ^3.0