A Kirby Toolkit style toolkit for IndieWeb stuff.
This repo was an attempt to bridge between other code. Feel free to start something new based of this repo. Please use an up to date version of the PHP microformats parser.
This toolkit is meant to be used next to the Kirby Toolkit. This is also a dependency.
A wrapper for the php-mf2 Microformats2 parser.
-
mf2::parse($html, $url = null)
To parse a HTML string. Returns Microformats2 as an associative array. -
mf2::fetch($url)
Fetch Microformats from a URL. Returns Microformats2 as an associative array. -
mf2::tojf2($mf2)
Flattens a Microformats2 array to the experimental jf2 format.
Do things with webmentions.
-
webmention::discoverEndpoint($url)
Discovers an endpoint of a URL.TODO: solve relative urls better (see getkirby-v2/toolkit#213)
A helper class for Micropub requests
Usage:
// Set URL and access token of the endpoint to use
micropub::setEndpoint('http://yoursite.com/micropub', 'xxx');
micropub::reply('http://example.com/a-nice-post', "Oh what a post!");
micropub::like('http://example.com/another-post');
micropub::rsvp('http://example.com/an-event', 'maybe');
$newURL = micropub::send([
'name' => 'Custom posts are possible!',
'content' => 'This is a story about (...)',
'category' => ['story', 'custom'],
'mp-slug' => 'custom-posts-are-possible',
'mp-syndicate-to' => 'https://twitter.com/example',
]);
go($newURL);
-
micropub::like($url)
Like a post -
micropub::reply($url, $message)
Reply to a post -
micropub::note($content)
Create basic post -
micropub::rsvp($url, $rsvp = 'yes', $message = null)
RSVP 'yes' to an event, or set$rsvp
and$message
for custom RSVPs. -
micropub::bookmark($url)
Bookmark a post (sendsbookmark-of
) -
micropub::send($data, $endpoint = null)
Create your own Micropub request. With the second param you can set a custom endpoint as an array with['endpoint' => 'http://example.com/micropub', 'token' => 'xxx']
. -
micropub::setEndpoint($url, $token)
Set the endpoint to use. -
micropub::getEndpoint()
Returns the current endpoint array.
=== Endpoint ===
See here for now: https://seblog.nl/2017/02/05/1/day-21-basic-micropub-endpoint