PHP code example of socialweb / atproto
1. Go to this page and download the library: Download socialweb/atproto library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
socialweb / atproto example snippets
// This is very rough and in no way represents the final recommended
// usage of this library.
use SocialWeb\Atproto\Api\Client;
$client = new Client('https://bsky.social');
$client->login('YOUR_EMAIL_ADDRESS', 'YOUR_PASSWORD');
$homeFeed = $client->getTimeline()->feed;
foreach ($homeFeed as $item) {
echo "{$item->post->author->displayName} (@{$item->post->author->handle}) says:\n\n";
echo "{$item->post->record->text}\n\n";
if (isset($item->post->record->reply)) {
echo "in reply to {$item->post->record->reply->parent->uri}\n\n";
}
echo str_repeat('-', 72);
echo "\n\n";
}