PHP Library for Pixelfed
Install with Composer
composer require dansup/pixelfed-php
You need a token from a Pixelfed instance. Navigate to /settings/applications
on the Pixelfed instance and generate a new Personal Access Tokens
. Use that token for authentication.
php -f examples/nodeinfo.php
Returns current user.
GET /api/v1/accounts/verify_credentials
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->user();
Fetch account by user id.
GET /api/v1/accounts/{$id}
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountById($id);
Fetch account followers by user id.
GET /api/v1/accounts/{$id}/followers
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowersById($id);
Fetch account following by user id.
GET /api/v1/accounts/{$id}/following
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowingById($id);
Fetch account statuses by user id.
GET /api/v1/accounts/{$id}/statuses
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountStatusesById($id);
Fetch accounts by search query.
GET /api/v1/accounts/search?q={$id}
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountSearch($id);
Fetch account blocks of current user.
GET /api/v1/blocks
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountBlocks();
Fetch likes of current user.
GET /api/v1/favourites
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountLikes();
Fetch follow requests of current user.
GET /api/v1/follow_requests
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowRequests();
Fetch pixelfed instance data.
GET /api/v1/instance
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->instance();
Fetch account mutes of current user.
GET /api/v1/mutes
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountMutes();
Fetch notifications of current user.
GET /api/v1/notifications
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountNotifications();
Fetch home timeline.
GET /api/v1/timelines/home
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->homeTimeline();
Fetch public timeline.
GET /api/v1/timelines/public
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->publicTimeline();
Fetch status by id.
GET /api/v1/statuses/{$id}
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusById($id);
Fetch reblogs/shares by status id.
GET /api/v1/statuses/{$id}/reblogged_by
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusRebloggedById($id);
Fetch likes by status id.
GET /api/v1/statuses/{$id}/favourited_by
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusLikedById($id);
Follow account by id.
POST /api/v1/accounts/{$id}/follow
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->followAccountById($id);
Unfollow account by id.
POST /api/v1/accounts/{$id}/unfollow
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->unfollowAccountById($id);
Block account by id.
POST /api/v1/accounts/{$id}/block
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountBlockById($id);
Unblock account by id.
POST /api/v1/accounts/{$id}/unblock
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountUnblockById($id);
Like status by id.
POST /api/v1/statuses/{$id}/favourite
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusFavouriteById($id);
Unlike status by id.
POST /api/v1/statuses/{$id}/unfavourite
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusUnfavouriteById($id);
Upload media.
POST /api/v1/media
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->mediaUpload($file);
Mute account by id.
POST /api/v1/accounts/{$id}/mute
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountMuteById($id);
Unmute account by id.
POST /api/v1/accounts/{$id}/unmute
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountUnmuteById($id);
statusCreate($mediaIds = [], $caption = null, $sensitive = false, $scope = 'public', $inReplyToId = null)
Create new status, requires $mediaIds
from mediaUpload()
POST /api/v1/statuses
AUTHENTICATION REQUIRED
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusCreate($mediaIds, $caption = null, $sensitive = false, $scope = 'public', $inReplyToId = null);
Fetch instance nodeinfo.
GET /api/nodeinfo/2.0.json
use \Pixelfed\PixelfedApi;
$domain = 'https://pixelfed.social';
$api = new PixelfedApi($domain);
$data = $api->nodeinfo();
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.