happytodev/blueskyapiwithphp

A PHP Package to interact with Bluesky API

v0.1.0 2024-07-26 17:36 UTC

This package is auto-updated.

Last update: 2024-12-02 02:16:48 UTC


README

Latest Version on Packagist Tests Total Downloads

A package to interact with Bluesky API with PHP.

Support me

I invest a lot of time to create many things for the community. You can sponsor me if you want.

Installation

You can install the package via composer:

composer require happytodev/blueskyapiwithphp

Usage

A little example with Laravel but you can use in plain PHP or with your favorite framework too. It's up to you.

<?php

namespace App\Http\Controllers;

use Happytodev\Blueskyapiwithphp\Blueskyapiwithphp;

class BlueskyController extends Controller
{
    protected $blueskyApi;

    public function __construct()
    {
        $this->blueskyApi = new Blueskyapiwithphp(config('services.bluesky.api_key'));
    }

    public function showLikes($handle, $postId)
    {
        $likes = $this->blueskyApi->getPostLikes($handle, $postId);

        return view('likes', compact('likes'));
    }

    public function showPostLikesNumber($handle, $postId)
    {
        $likesCount = $this->blueskyApi->getPostLikesCount($handle, $postId);
        $repostsCount = $this->blueskyApi->getPostRepostsCount($handle, $postId);
        $repliesCount = $this->blueskyApi->getPostRepliesCount($handle, $postId);

        dd($likesCount, $repostsCount, $repliesCount);
    }
}

Testing

composer test

Changelog

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

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.