dev-master
9999999-dev http://github.com/kayue/PubSubHubbubBundleA Symfony PubSubHubbub bundle
MIT
The Requires
- php >=5.3.3
- symfony/framework-bundle >=2.1.0
by Hearsay
bundle symfony pubsubhubbub
Wallogit.com
2017 © Pedro Peláez
A Symfony PubSubHubbub bundle
This is a Symfony2 bundle which helps your application act as a subscriber to a PubSubHubbub hub. Supports subscription via Superfeedr., (*1)
$ git submodule add git@github.com:hearsayit/PubSubHubbubBundle.git src/vendors/bundles/Hearsay/PubSubHubbubBundle
// app/autoload.php
$loader->registerNamespaces(array(
// ...
'Hearsay' => __DIR__.'/../vendor/bundles',
// ...
));
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Hearsay\PubSubHubbubBundle\HearsayPubSubHubbubBundle(),
// ...
);
}
# app/config/routing.yml
# ...
_pubsubhubbub:
resource: @HearsayPubSubHubbubBundle/Resources/config/routing.yml
The minimal configuration takes a hub URL and a callback specification:, (*2)
hearsay_pub_sub_hubbub:
hub: http://hub.com
callback:
host: your.app.com # Must be explicitly specified
base_url: /your_app_subdirectory # Defaults to empty
scheme: https # Defaults to http
The callback configuration is required to allow for consistent callback URLs no matter how you subscribe to feeds (from the command line, from a web interface, etc.)., (*3)
You can specify a service implementing Hearsay\PubSubHubbubBundle\Topic\TopicProviderInterface
to control your allowed topic subscriptions (the default provider allows
subscriptions to or unsubscriptions from any topic URL, so it's useful for
testing but not at all secure):, (*4)
hearsay_pub_sub_hubbub:
# ...
provider:
service: your_service_id
A Doctrine provider is included if your topics are database entities:, (*5)
hearsay_pub_sub_hubbub:
# ...
provider:
doctrine:
entity: \Your\Topic\Entity # Must implement Hearsay\PubSubHubbubBundle\Topic\TopicInterface
You can specify a service implementing Hearsay\PubSubHubbubBundle\Handler\NotificationHandlerInterface
to handle push notifications as they arrive (the default handler dispatches
onPushNotificationReceived events):, (*6)
hearsay_pub_sub_hubbub:
# ...
handler: your_handler_service
Connecting to the Superfeedr hub requires some additional information:, (*7)
hearsay_pub_sub_hubbub:
# ...
superfeedr:
username: superfeedr_username
password: superfeedr_password
digest: true # Whether to receive daily digest notifications (false by default)
To subscribe or unsubscribe from a topic from the command line (topic_id is the ID passed to your topic provider; if no provider is configured, this is just the topic URL):, (*8)
app$ ./console pubsubhubbub:subscribe [-u] topic_id
Or, from a controller:, (*9)
$this->get('hearsay_pubsubhubbub.hub_subscriber')->subscribe($topicId);
$this->get('hearsay_pubsubhubbub.hub_subscriber')->unsubscribe($topicId);
A Symfony PubSubHubbub bundle
MIT
bundle symfony pubsubhubbub