Download the PHP package taproot/subscriptions without Composer
On this page you can find all versions of the php package taproot/subscriptions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package subscriptions
taproot/subscriptions
taproot/subscriptions is a small framework for easily subscribing to web content from Silex/Symfony+Pimple projects.
It provides an API (as well as some minimal web UIs) for subscribing to future updates to resources as well as crawling historical content. Currently only HTML resources are supported fully.
Installation
Install using Composer:
./composer.phar require taproot/subscriptions:~0.1
Setup
taproot/subscriptions requires a few services in order to work properly. They should be set up approximately like this:
Then, set up taproot/subscriptions and mount its routes somewhere on your app by calling Taproot\Subscriptions\controllers()
:
The first argument is a reference to $app if you’re using Silex, or your Pimple-compatible dependency container otherwise. All other arguments are optional callbacks.
The second is an authorization callback and will be called with the current $request before every non-public request.
It should check if the current user is authorized and abort otherwise.
The third is a shortcut for adding a listener for the subscriptions.ping
event — it’s a callable which
Web UI
Navigate to wherever you mounted the subscriptions routes on your site to see the web UI. It lists your current subscriptions as well as allowing you to subscribe or subscribe+crawl, view individual subscription information and individual ping content.
API
Subscribe to a feed
Subscribe to a feed and crawl historical content
Perform tasks on new/old content
Whenever a feed resource, whether current from a subscription ping or historical from crawling rel=prev[ious] links, the subscriptions.ping
event is dispatched on $app['dispatcher']
with a GenericEvent containing information about the resource.
You can either attach a listener to that event, or pass one as the third argument to Subscriptions\controllers() — they accomplish the exact same thing, one is just a shortcut.
TODO: document exactly what properties the event has.
Your handlers should be written in such a way that running them over the same content multiple times doesn’t produce duplicate results, as it’s entirely possible that they will be run multiple times.
E.G. a typical h-feed subscription should looks something like this (pseudocode):
Changelog
dev-master (unversioned so far)
- Added unsaved “resource” key to
$subscription
return value, containing HTML+URL+microformats and such things, for immediate use - Standardised how resource-processing event contexts are built
- Changed the PdoSubscriptionStorage ID column definition to varchar to allow more flexible IDs
v0.1.0
- First version
All versions of subscriptions with dependencies
mf2/mf2 Version *
mf2/shim Version *
monolog/monolog Version *
guzzle/guzzle Version *