Skip to main content

Overview

The Bluesky facade is a thin wrapper over BlueskyManager. BlueskyManager manages the active Agent (either LegacyAgent or OAuthAgent) and delegates commonly used API calls through the HasShortHand trait.

Architecture

BlueskyServiceProvider registers Factory::class bound to BlueskyManager as a scoped singleton (one instance per request lifecycle).
The facade’s getFacadeAccessor() resolves this binding.

BlueskyManager core methods

The following methods are defined directly on BlueskyManager, separate from the HasShortHand trait methods.

Authentication

Agent management

HTTP clients

Utilities

The HasShortHand trait

The HasShortHand trait wraps low-level AT Protocol APIs into readable PHP methods. Adding use HasShortHand; to BlueskyManager makes all of these methods directly accessible via Bluesky::.
Separating the shortcuts into a trait keeps BlueskyManager focused on session and agent management while still exposing a rich API surface. It also makes individual methods easier to test or override.

Posts and feeds

Engagement

Follows

Profile and account

Media

Notifications

AT Protocol record operations

Feed generators and labelers

Common shortcut examples

Create a post

Reply to a post

There is no dedicated reply() method in HasShortHand. You build the reply with Post::build() and pass a StrongRef for the parent, then call the regular post() shortcut.

Like and repost

Update your profile

upsertProfile() fetches the current profile and persists any changes made inside the closure. Use the Profile object’s methods to set the display name, description, and more.

Self-labels

Use SelfLabels to add self-labels to the account.

Call any API directly

When HasShortHand does not have a shortcut for what you need, use send() or client().

Facade vs. direct container access

Bluesky::post() and app(Factory::class)->post() operate on the same BlueskyManager instance.
Because the binding uses scoped, the session state set by login() is preserved for the rest of the current request.

Conditionable and Macroable

BlueskyManager includes the Conditionable and Macroable traits from Laravel.

Conditionable: when() / unless()

Macroable: adding custom methods

You can extend BlueskyManager with your own methods using macro(). A common place to register macros is in AppServiceProvider::boot().

Injecting a custom agent

Use withAgent() to set any Agent implementation directly.
In practice, withAgent() is most useful in tests. Normal application code should use login() or withToken(), which set the agent automatically.
Last modified on April 26, 2026