Download the PHP package gimucco/bluesky-php without Composer

On this page you can find all versions of the php package gimucco/bluesky-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bluesky-php

bluesky-php

Latest Version PHP Version CI Static Analysis License

A typed PHP client for the Bluesky / AT Protocol API — built on gimucco/atproto-php for OAuth 2.1 / DPoP authentication.

At a glance

Cheat sheet

Domain Methods
Posting post(), reply(), thread(), deletePost()
Embeds EmbeddedImage, EmbeddedVideo, EmbeddedExternal, EmbeddedRecord, EmbeddedRecordWithMedia
Engagement like() / unlike(), repost() / unrepost()
Social graph follow() / unfollow(), block() / unblock(), mute() / unmute()
Reading myProfile(), getPost()
Media uploads uploadImage(), uploadVideo(), postVideo(), awaitVideo()
Pagination feed->paginateTimeline(), graph->paginateFollowers(), … (28 auto-generated) + Pager::iterate() for custom shapes
Lexicon API $client->actor, $client->feed, $client->graph, $client->notification, $client->repo, $client->identity, $client->server, $client->label, $client->video, $client->bookmark, $client->labeler
Identifiers Did, Handle, AtUri (validated, Stringable)
Refs PostRef, FollowRef, LikeRef, RepostRef, BlockRef (all Stringable to their uri)

See examples/ for runnable code per use case.

Installation

Requirements: PHP 8.2+, ext-json, ext-fileinfo, ext-curl, ext-openssl, ext-sodium (curl/openssl/sodium come from gimucco/atproto-php).

Authentication: OAuth only

This library performs Bluesky/AT Protocol API calls. It does not handle authentication — that's gimucco/atproto-php, which implements the AT Protocol's mandatory OAuth 2.1 + DPoP + PAR profile.

There is no app-password / identifier+password flow. App passwords are deprecated; OAuth 2.1 is the only path. To use this library you set up the OAuth flow once (login redirect → callback → stored session), then restore the session by DID for subsequent API calls.

For long-running automation: log in once interactively, then reuse the persisted session indefinitely (tokens auto-refresh).

Quick start

The shortest possible example, assuming you already have a stored session:

OAuth setup (one-time)

  1. Generate an ES256 key

  2. Host two static JSON files at HTTPS URLs (client-metadata.json and jwks.json). Use bin/generate-metadata from vendor/gimucco/atproto-php to produce them.
  3. Configure & build the OAuth client — see examples/bootstrap.php for the runtime restore pattern.

Restoring a session at runtime

Posting

Plain text

Reply

For nested replies in a thread, also pass rootUri and rootCid of the thread root.

Thread

For long threads, throttle to avoid burst rate limits:

Note: thread() is not transactional — if a mid-thread post fails, prior posts remain published. See the method's docblock for partial-failure semantics.

All 5 embed types

A post can carry at most one embed (the EmbeddedRecordWithMedia type combines a quote with images/video). Mismatch throws InvalidArgumentException.

EmbeddedExternal rejects non-http(s) URIs at construction time.

Media

Images

Empty bytes or empty MIME string throws InvalidArgumentException.

Video

Bluesky processes videos asynchronously, but the convenience methods hide the polling. Three levels of API, in order of decreasing convenience:

All three block the calling thread — fine for CLI / cron / queue, not appropriate inside a synchronous web request. The default await timeout is 120 s (exponential backoff capped at 10 s/poll); pass a smaller timeoutSeconds from a request with a max execution budget.

Video calls do not go to the user's PDS — Bluesky operates a dedicated video processing service at https://video.bsky.app. The library handles routing transparently: each call mints a short-lived service-auth JWT via the user's PDS (com.atproto.server.getServiceAuth) with the audience set to the user's PDS DID (did:web:<pdsHost>, derived from the live session) and sends it as a plain bearer token to the video service, which validates the issuer chain back to the user's PDS. Uploads use lxm=com.atproto.repo.uploadBlob (the video service treats them as generic blob uploads); status / limits use their lexicon-defined lxm values. Re-uploading the exact same bytes (content-hash dedupe) is recognized server-side and returned as a successful job — no 409 thrown. The HTTP path uses curl with explicit timeouts (10 s connect, 120 s total upload, 30 s status) and SSL verification on. To target a different video service host, pass videoServiceUrl: 'https://your-video-service' to new Client(...).

Engagement

Social graph

follow() and block() accept handle, DID, Did, or Handle. Handles are auto-resolved to DIDs (one extra API call). mute() accepts both directly (no resolution needed).

Reading

The full generated API surface is on $client->actor, $client->feed, $client->graph, etc. See examples/notifications.php.

Pagination

34 of the 93 generated methods accept cursor and return {cursor, items}. Each gets a typed paginate* companion:

For custom shapes or non-generated endpoints, use Pager::iterate():

Typed identifiers

All five Ref classes (PostRef, FollowRef, LikeRef, RepostRef, BlockRef) are Stringable to their uri — you can pass them directly to delete methods (unfollow($followRef), etc.).

Logging

Convenience methods emit debug-level events on post/follow/like/etc. Heads up: log context includes subject DIDs and post URIs, so a shared log file becomes a who-blocks-whom audit trail. Configure your logger accordingly.

Error handling

Code generation

The src/Generated/ directory is produced from AT Protocol lexicon JSONs (which are not committed — fetched on demand via composer sync-lexicons).

Skipped namespaces (out of scope for this library): com.atproto.sync.*, chat.bsky.*, tools.ozone.*, com.atproto.admin.*, com.atproto.temp.*, com.atproto.moderation.*, app.bsky.unspecced.*.

Development

For real-API smoke tests against your test account, see tests/manual/.

Project structure

License

GPL-2.0-or-later. See LICENSE.


All versions of bluesky-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-fileinfo Version *
ext-json Version *
gimucco/atproto-php Version ^0.2
psr/http-message Version ^1.1 || ^2.0
psr/log Version ^2.0 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gimucco/bluesky-php contains the following files

Loading the files please wait ...