Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trovster/laravel-webfinger
A Laravel package to create an ActivityPub webfinger
https://github.com/trovster/laravel-webfinger
activitypub json laravel mastodon php social-web webfinger
Last synced: 2 months ago
JSON representation
A Laravel package to create an ActivityPub webfinger
- Host: GitHub
- URL: https://github.com/trovster/laravel-webfinger
- Owner: trovster
- License: mit
- Created: 2023-02-12T12:07:25.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-12T18:16:43.000Z (10 months ago)
- Last Synced: 2024-04-18T14:14:29.511Z (8 months ago)
- Topics: activitypub, json, laravel, mastodon, php, social-web, webfinger
- Language: PHP
- Homepage:
- Size: 34.2 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Create a Webfinger in Laravel
This creates a [webfinger](https://webfinger.net), 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:
```bash
composer require surface/laravel-webfinger
```You must add the configuration to your `.env` file:
```bash
WEBFINGER_INSTANCE=mastodon.instance
WEBFINGER_USERNAME=your-username
```You can publish the config file with:
```bash
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.```php
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
website = 'https://www.example.com';
}public function links(Request $request): array
{
return [
...parent::links($request),
[
'rel' => 'self',
'type' => 'text/html',
'href' => $this->website,
],
];
}
}
```## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed
recently.## Credits
- [Trevor Morris](https://github.com/trovster)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more
information.