Giter Site home page Giter Site logo

pixelfed-php's Introduction

Pixelfed PHP Library

PHP Library for Pixelfed

Installation

Install with Composer

composer require dansup/pixelfed-php

Authentication

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.

Examples

Nodeinfo

php -f examples/nodeinfo.php

Methods

user()

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

accountById($id)

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

accountFollowersById($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);

accountFollowingById($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);

accountStatusesById($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);

accountSearch($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);

accountBlocks()

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

accountLikes()

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

accountFollowRequests()

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

instance()

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

accountMutes()

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

accountNotifications()

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

homeTimeline()

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

publicTimeline()

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

statusById($id)

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

statusRebloggedById($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);

statusLikedById($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);

followAccountById($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);

unfollowAccountById($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);

accountBlockById($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);

accountUnblockById($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);

statusFavouriteById($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);

statusUnfavouriteById($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);

mediaUpload($file)

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

accountMuteById($id)

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

accountUnmuteById($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);

nodeinfo()

Fetch instance nodeinfo.

GET /api/nodeinfo/2.0.json

use \Pixelfed\PixelfedApi;

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

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

pixelfed-php's People

Contributors

dansup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pixelfed-php's Issues

What is the api to fetch trending tags or hashtags in pixelfed?

I am unable to fetch trending tags or hashtags from pixelfed.social .
I have tried https://www.pixelfed.social/api/v1/trends/tags, but it doesnt work.

https://www.mastodon.social/api/v1/trends/tags this works though.

Does that mean pixelfed doesnt have this endpoint (users post pictures with tags so there should be a way to get most popular hashtags/tags), or is it changed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.