定制 aazsamir/libphpsky 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aazsamir/libphpsky

最新稳定版本:v0.8.0

Composer 安装命令:

composer require aazsamir/libphpsky

包简介

PHP library for interacting with ATProto protocol

README 文档

README

Libphpsky is a PHP library designed to interact with the Bluesky decentralized social media protocol. All types are generated from the Bluesky protocol schema, along with queries and procedures, ensuring everything is statically typed.

Note: This is not an official library and is not affiliated with Bluesky.

Table of Contents

Installation

To install Libphpsky, use Composer:

composer require aazsamir/libphpsky

For integration with Laravel, use aazsamir/libphpsky-laravel package:

composer require aazsamir/libphpsky-laravel

For integration with Symfony, use aazsamir/libphpsky-symfony package:

composer require aazsamir/libphpsky-symfony

Documentation

Check docs at https://aazsamir.github.io/libphpsky/.

Usage

The default implementation handles authorization out of the box by providing ATPROTO_LOGIN and ATPROTO_PASSWORD environment variables. If the session is stale, it will automatically refresh it.

$resolveHandle = ResolveHandle::default();
$did = $resolveHandle->query('bsky.app')->did;

$getProfile = GetProfile::default();
$response = $getProfile->query($did);

On top of that, there is a meta client, which can be used to handle all possible endpoints.

$client = new ATProtoMetaClient();
$resolved = $client->comAtprotoIdentityResolveHandle()->query('bsky.app');

Libphpsky also supports \Amp\Http\Client\HttpClient from amphp/http-client package out of the box.

$client = ATProtoClientBuilder::default()->useAsync(true)->build();
$getProfile = new GetProfile($client);
$actors = ['bsky.app', 'steampowered.com'];
$futures = [];

foreach ($actors as $actor) {
    $futures[] = \Amp\async(fn() => $getProfile->query($actor));
}

[$errors, $profiles] = \Amp\Future\awaitAll($futures);

Examples

libphpsky-feed is an example project that uses libphpsky to serve a bluesky feed.

For more examples, check examples directory.

Features

  • Comprehensive interaction with the ATProtocol
  • Statically typed queries, procedures and objects
  • Authorization and automatic session management
  • Query caching
  • Amphp client support
  • Subscriptions over WebSockets
  • Custom lexicons support

Contributing

Contributions are welcome! Just make sure that phpstan, php-cs-fixer and phpunit pass.

License

Libphpsky is licensed under the MIT License. See the LICENSE file for more details.

统计信息

  • 总下载量: 130
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 2
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固