surface/laravel-webfinger 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

surface/laravel-webfinger

最新稳定版本:v2.0.0

Composer 安装命令:

composer require surface/laravel-webfinger

包简介

A Laravel package to create an ActivityPub webfinger.

README 文档

README

This creates a webfinger, a way to attach information to an email address, or an other online resource. Once installed you should see your JSON webfinger profile at /.well-known/webfinger.

Installation

You can install the package via composer:

composer require surface/laravel-webfinger

You must add the configuration to your .env file:

WEBFINGER_INSTANCE=mastodon.instance WEBFINGER_USERNAME=your-username

You can publish the config file with:

php artisan vendor:publish --provider="Surface\LaravelWebfinger\LaravelWebfingerServiceProvider"

Extending the Resource

The resource which is converted to the JSON response is bound to the service container. This allows you to easily override the resource and add extra information. To change the binding, add the following to your app service provider.

use App\Http\Resources\Webfinger as WebfingerResource; use Surface\LaravelWebfinger\Http\Resources\Webfinger as PackageWebfinger; use Surface\LaravelWebfinger\Service\Webfinger as WebfingerService; $this->app->bind( PackageWebfinger::class, static fn (Container $app): WebfingerResource => new WebfingerResource( ...$app->make(WebfingerService::class) ) );

Then you would create your custom resource which extends the base.

<?php namespace App\Http\Resources; use Illuminate\Http\Request; use Illuminate\Support\Stringable; use Surface\LaravelWebfinger\Http\Resources\Webfinger as JsonResource; class Webfinger extends JsonResource { protected string $website; public function __construct(protected Stringable $instance, protected Stringable $username) { parent::__construct($instance, $username); $this->website = 'https://www.example.com'; } public function links(Request $request): array { return [ ...parent::links($request), [ 'rel' => 'self', 'type' => 'text/html', 'href' => $this->website, ], ]; } }

Testing

composer test

Changelog

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

Credits

License

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

统计信息

  • 总下载量: 3.25k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 11
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 11
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固