PHP code example of dansup / pixelfed-php

1. Go to this page and download the library: Download dansup/pixelfed-php 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/ */

    

dansup / pixelfed-php example snippets


use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->user();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowersById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowingById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountStatusesById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountSearch($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountBlocks();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountLikes();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountFollowRequests();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->instance();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountMutes();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountNotifications();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->homeTimeline();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->publicTimeline();

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusRebloggedById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusLikedById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->followAccountById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->unfollowAccountById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountBlockById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountUnblockById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusFavouriteById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->statusUnfavouriteById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->mediaUpload($file);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountMuteById($id);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$token = 'personal-access-token-here';
$api = new PixelfedApi($domain, $token);
$data = $api->accountUnmuteById($id);

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);

use \Pixelfed\PixelfedApi;

$domain = 'https://pixelfed.social';
$api = new PixelfedApi($domain);
$data = $api->nodeinfo();
bash
composer 
bash
php -f examples/nodeinfo.php