Overview
This page is the Laravel version of the AT Protocol official bot tutorial. It covers how to implement the same functionality in PHP/Laravel using thelaravel-bluesky package instead of TypeScript.
The official tutorial uses the lex command to download Lexicon files. With laravel-bluesky, all Lexicons are already bundled via atproto-lexicon-contracts, so this step is not needed. You can accomplish nearly everything through Artisan commands and the HasShortHand trait methods.
Prerequisites
- The
laravel-blueskypackage is installed - A Bluesky account and app password are ready
Part 1: Basic bot (posting)
Create an Artisan command
Usephp artisan make:command to create a bot command.
app/Console/Commands/BotPostCommand.php.
Run manually
Schedule with task scheduler
Add a schedule entry toroutes/console.php.
Run with GitHub Actions
If you don’t have a server, you can run the bot automatically with GitHub Actions.Part 2: Reply bot (mention monitoring)
Build a bot that automatically replies to mentions. This section also shows how to generate AI replies.Fetch notifications and reply to mentions
When the thread root differs from the parent post, fetch the thread using
app.bsky.feed.getPostThread and set the correct root. This simplified example uses the parent post as the root.Schedule polling
Generate AI replies
You can combine thelaravel/ai package with the laravel-amazon-bedrock driver to generate context-aware AI replies.
Part 3: Label bot
This corresponds to thelabelAsBot function in the official tutorial. Add a self-label to the bot account’s profile to identify it as an automated account.
Run this command once during initial setup. It is independent from the Part 1 and Part 2 commands.
Create the label command
Run the command
Other official tutorials
The AT Protocol official tutorials cover several other topics. Here is a summary of howlaravel-bluesky covers each one.
Custom feeds
Feed Generator covers building a custom feed generator with Laravel in detail.OAuth authentication
Socialite explains how to implement OAuth authentication using Laravel Socialite. This is simpler than the official approach.Social app (statusphere)
A Laravel version of statusphere is available at invokable/statusphere. It is based on an earlier version of statusphere that does not use thelex or tap commands, so it differs slightly from the latest official tutorial.