Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rtio committed Nov 25, 2022
1 parent 37b2cda commit 7c957fc
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 1,520 deletions.
14 changes: 7 additions & 7 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ pygments: true
enableRobotsTXT: true

# Site name (head)
name: ActivityPhp Documentation
name: ActivityPhp Core Documentation

# Site description (head)
description: A PHP implementation of ActivityPub protocol based upon the ActivityStreams 2.0 data format.
description: A PHP implementation of ActivityPub core types protocol based upon the ActivityStreams 2.0 data format.

# Github repositories and download URLs
repository_url : https://github.com/landrok/activitypub
doc_repository_url: https://github.com/landrok/activitypub/tree/master/docs
github_author_url : https://github.com/landrok
doc_baseurl : https://landrok.github.io/activitypub
github_author_name: landrok
repository_url : https://github.com/rtio/activitypub-core
doc_repository_url: https://github.com/rtio/activitypub-core/tree/master/docs
github_author_url : https://github.com/rtio
doc_baseurl : https://rtio.github.io/activitypub-core
github_author_name: rtio

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
source_suffix = '.rst'
master_doc = 'index'
project = u'ActivityPhp'
copyright = u'Landrok'
copyright = u'rtio'
version = '1'
html_title = "ActivityPhp Documentation"
html_short_title = "ActivityPhp"
Expand Down
222 changes: 5 additions & 217 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ Basics
- [Use your own extended types]({{ site.doc_baseurl }}/#use-your-own-extended-types)
- [Create your own property validator]({{ site.doc_baseurl }}/#create-your-own-property-validator)
- [Dialects management]({{ site.doc_baseurl }}/activitypub-dialects-management.html)
- [Server](#server)
- [Server instance configuration]({{ site.doc_baseurl }}/activitypub-server-usage.html)
- [Verify HTTP signatures]({{ site.doc_baseurl }}/activitypub-server-verify-http-signatures.html)
- [WebFinger]({{ site.doc_baseurl }}/#webfinger)
- [WebFinger::toArray()]({{ site.doc_baseurl }}/#webfingertoarray)
- [WebFinger::getSubject()]({{ site.doc_baseurl }}/#webfingergetsubject)
- [WebFinger::getProfileId()]({{ site.doc_baseurl }}/#webfingergetprofileid)
- [WebFinger::getHandle()]({{ site.doc_baseurl }}/#webfingergethandle)
- [WebFinger::getAliases()]({{ site.doc_baseurl }}/#webfingergetaliases)
- [WebFinger::getLinks()]({{ site.doc_baseurl }}/#webfingergetlinks)
- [Examples]({{ site.doc_baseurl }}/#server-examples)

________________________________________________________________________

Expand All @@ -68,7 +57,7 @@ Install
-------

```sh
composer require landrok/activitypub
composer require rtio/activitypub-core
```
________________________________________________________________________

Expand All @@ -77,7 +66,7 @@ Types

### Type factory

You can instanciate ActivityStreams types using their short name.
You can instantiate ActivityStreams types using their short name.

```php
use ActivityPhp\Type;
Expand All @@ -87,7 +76,7 @@ $note = Type::create('Note');

```

Instanciating a type and setting properties is possible with the second
Instantiate a type and setting properties is possible with the second
parameter.

```php
Expand All @@ -100,7 +89,7 @@ $note = Type::create('Note', [
```

Starting from an array with a 'type' key, it's even possible to directly
instanciate your type.
instantiate your type.

```php
use ActivityPhp\Type;
Expand Down Expand Up @@ -519,218 +508,17 @@ and how to use them thanks to

________________________________________________________________________


Server
------

A server instance is the entry point to a federation.

Its purpose is to receive, send and forward activities appropriately.

A minimalistic approach is:

```php
use ActivityPhp\Server;

$server = new Server();
```

It's sufficient to make [some public requests](#server-examples).

For more advanced server configurations, Have a look at [Server Manual]({{ site.doc_baseurl }}/activitypub-server-usage.html).

### WebFinger

WebFinger is a protocol that allows for discovery of information about
people.

Given a handle, ActivityPub instances can discover profiles using this
protocol.

```php
use ActivityPhp\Server;

$server = new Server();

$handle = '[email protected]';

// Get a WebFinger instance
$webfinger = $server->actor($handle)->webfinger();
```

In this implementation, we can use an Object Identifier (URI) instead of
a WebFinger handle.


```php
use ActivityPhp\Server;

$server = new Server();

$handle = 'https://example.org/users/bob';

// Get a WebFinger instance
$webfinger = $server->actor($handle)->webfinger();
```
________________________________________________________________________

### WebFinger::toArray()

Get all WebFinger data as an array.

```php
use ActivityPhp\Server;

$server = new Server();

$handle = '[email protected]';

// Get a WebFinger instance
$webfinger = $server->actor($handle)->webfinger();

// Dumps all properties
print_r($webfinger->toArray());

// A one line call
print_r(
$server->actor($handle)->webfinger()->toArray()
);
```

Would output something like:

```
Array
(
[subject] => acct:[email protected]
[aliases] => Array
(
[0] => http://example.org/users/bob
)
[links] => Array
(
[0] => Array
(
[rel] => self
[type] => application/activity+json
[href] => http://example.org/users/bob
)
)
)
```
________________________________________________________________________

### WebFinger::getSubject()

Get a WebFinger resource.

```php
echo $webfinger->getSubject();

// Would output 'acct:[email protected]'
```
________________________________________________________________________

### WebFinger::getProfileId()

Get ActivityPub object identifier (URI).

```php
echo $webfinger->getProfileId();

// Would output 'http://example.org/users/bob'
```
________________________________________________________________________

### WebFinger::getHandle()

Get a profile handle.

```php
echo $webfinger->getHandle();

// Would output '[email protected]'
```
________________________________________________________________________

### WebFinger::getAliases()

Get all aliases entries for this profile.

```php
print_r(
$webfinger->getAliases()
);
```

Would output something like:

```
Array
(
[0] => http://example.org/users/bob
)
```

________________________________________________________________________

### WebFinger::getLinks()

Get all links entries for this profile.

```php

print_r(
$webfinger->getLinks()
);

```

Would output something like:

```
Array
(
[0] => Array
(
[rel] => self
[type] => application/activity+json
[href] => http://example.org/users/bob
)
)
```

________________________________________________________________________


Server examples
---------------

- [Fetch Peertube Outbox activities]({{ site.doc_baseurl }}/fetch-peertube-outbox-activities.html)
- [A better way to fetch Peertube Outbox activities]({{ site.doc_baseurl }}/fetch-peertube-outbox-activities-using-dialects.html)
- [An even better way to fetch Peertube Outbox activities]({{ site.doc_baseurl }}/fetch-peertube-outbox-activities-using-ontologies.html)

________________________________________________________________________


More
----

- [Contribute on Github](https://github.com/landrok/activitypub)

- To discuss new features, make feedback or simply to share ideas, you
can contact me on Mastodon at
[https://cybre.space/@landrok](https://cybre.space/@landrok)
- [Contribute on Github](https://github.com/rtio/activitypub-core)

- [ActivityPub](https://www.w3.org/TR/activitypub/)

- [ActivityStreams 2.0](https://www.w3.org/TR/activitystreams-core/)

- [JSON-LD](https://www.w3.org/TR/json-ld/)

- [WebFinger](https://tools.ietf.org/html/rfc7033)

________________________________________________________________________


Expand Down
Loading

0 comments on commit 7c957fc

Please sign in to comment.