-
-
Notifications
You must be signed in to change notification settings - Fork 2
Bsky Facade
The BskyFacade
simplifies API interactions by providing a centralized, singleton-based interface for commonly used operations. With this facade, you can streamline your SDK usage and avoid deep method chains.
- Simplified API Calls: Replace complex chains with straightforward methods.
-
Helper Function: Use the
bskyFacade()
helper for quick access to the instance. - Singleton Design: Maintains a consistent, shared instance.
-
Error Handling: Ensures a valid
Client
is set during the first call, throwing anInvalidArgumentException
otherwise.
Initialize and use the BskyFacade
as follows:
// Access the facade using the helper function
$facade = bskyFacade($client); // or Atproto\BskyFacade::getInstance($client);
// Create a post
$post = $facade->post()->text("Hello, BlueSky!");
$createdRecord = $facade->createRecord()->record($post)->send();
echo $createdRecord->uri(); // Output: URI of the created post
Tip
The Client
must be provided during the first usage of BskyFacade
. After that, it will be reused automatically
in subsequent calls.
If needed, you can update the Client
instance at any point:
$client1 = new Client();
$client2 = new Client();
// Set or replace the current client
bskyFacade($client1); // First instance
bskyFacade($client2); // Replaces the previous client
This ensures flexibility while maintaining the simplicity of the singleton design.
Description | Link |
---|---|
Discord | You can join to Discord Server of the SDK |
Official Docs | AT Protocol Official Docs |
BlueSky Docs | BSky HTTP Reference Docs |
SDK Docs | SDK Official Docs |
Packagist | SDK available on Packagist |
Author | Created by @shahmal1yev with ❤️ |
Support | Support to my open source work on Github or Buymeacoffee |
Get started with BlueSky SDK today and integrate Bluesky into your projects! 🚀
-
🏠 Home
Introduction to the SDK and its features -
🚀 Quick Start
Get started quickly with the basics of using the Bluesky SDK -
⚙️ Installation
Step-by-step guide to installing the SDK -
🛠️ Architecture Overview
Learn about the SDK's structure and design principles -
📖 BskyFacade
Simplify API interactions with the facade -
💾 Serialization
Serialize and deserialize data effectively -
🔄 Session Management
Manage authentication and session reuse -
🧹 Casting
Explore type-safe response casting in the SDK -
💡 Examples
Practical usage examples for various features