Skip to content

dansup/laravel-activitypub

Repository files navigation

a batteries included ActivityPub package for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

composer require dansup/laravel-activitypub

You can publish the config file with:

php artisan vendor:publish --provider="Dansup\ActivityPub\ActivityPubServiceProvider" --tag="config"

This is the contents of the published config file:

return [
    'actor' => [
        'model' => \App\Models\User::class,
        'map' => [
            'name' => 'name',
            'username' => 'username',
            'summary' => 'bio',
            'url' => 'profile_url',
        ],
    ],
    'activities' => [
        'Note' => [
            'model' => \App\Models\Post::class,
            'map' => [
                'content' => 'content',
                'published' => 'created_at',
            ],
        ],
        'Like' => [
            'model' => \App\Models\Like::class,
            'map' => [
                'object' => 'likeable',
            ],
        ],
    ],
    'federation' => [
        'public_key' => env('ACTIVITYPUB_PUBLIC_KEY', 'storage/activitypub/public_key.txt'),
        'private_key' => env('ACTIVITYPUB_PRIVATE_KEY', 'storage/activitypub/private_key.txt'),
        'max_recipients' => env('ACTIVITYPUB_MAX_RECIPIENTS', 100),
        'max_attachments' => env('ACTIVITYPUB_MAX_ATTACHMENTS', 10),
        'rate_limit' => [
            'attempts' => 30,
            'decay_minutes' => 1,
        ],
        'retry' => [
            'attempts' => 3,
            'delay' => 5,
        ],
    ],
    'domain' => env('ACTIVITYPUB_DOMAIN', 'example.com'),
];

Usage

1) First, add the ActorTrait to your User model.

use Dansup\ActivityPub\Traits\ActorTrait;

class User extends Authenticatable
{
    use ActorTrait;
}

2) Configure your ActivityPub mappings in config/activitypub.php

Testing

composer test

Changelog

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

Contributing

Please see CONTRIBUTING for details.

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.

About

a batteries included ActivityPub package for Laravel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages