socialdept / atp-spaces
AT Protocol spaces (permissioned data) for Laravel
Requires
- php: ^8.3
- ext-json: *
- firebase/php-jwt: ^7.0
- guzzlehttp/guzzle: ^7.5|^8.0
- illuminate/console: ^11.0|^12.0|^13.0
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
- phpseclib/phpseclib: ^3.0
- socialdept/atp-client: ^0.3.3
- socialdept/atp-support: ^0.3.2
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
Read and write permissioned AT Protocol data in Laravel.
Warning
Don't use this in production. Spaces are an alpha AT Protocol extension. The lexicons this package is built against are still moving, and so is this package. It tracks the October 22, 2026 alpha release. Only alpha PDS software serves these endpoints today. Pin a version, expect breaking changes, and treat anything you store as throwaway.
This package works with atproto spaces, AT Protocol's permissioned data: records only certain people and applications can read. It creates and manages spaces, writes to your own repo inside them, reads every member's repo with one space credential, and checks what it reads against each member's host. To learn all about it, head over to the documentation.
Here are a few short examples of what you can do. Create a space you own and admit someone:
use SocialDept\AtpClient\Facades\Atp; use SocialDept\AtpSpaces\Management\SpacePolicy; $client = Atp::as('alice.example.com'); $space = $client->space->manage->createSpace('com.example.forum', SpacePolicy::memberList()); $client->space->manage->putMember($space, 'bob.example.com');
Write to your own repo inside it:
$client->space->repo->createRecord($space, 'com.example.thread', [ '$type' => 'com.example.thread', 'title' => 'Hello, members', ]);
Read someone else's repo inside it:
$reader = $client->space->read($space); $reader->listRepos(); $reader->listRecords('bob.example.com', 'com.example.thread');
Ask for access to a space with its own OAuth scope:
use SocialDept\AtpSpaces\Scopes\SpaceScope; use SocialDept\AtpSpaces\SpaceRef; $space = SpaceRef::make('did:plc:alice', 'com.example.forum', 'main'); (string) SpaceScope::forSpace($space)->readOnly(); // space:com.example.forum?authority=did:plc:alice&skey=main&action=read
It builds on atp-client for OAuth sessions and service auth, and on atp-support for identity resolution.
Documentation
You'll find the documentation on https://socialde.pt/docs/atp-spaces.
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 --exclude-group integration
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see LICENSE for more information.