Skip to content
This repository has been archived by the owner on Aug 31, 2020. It is now read-only.

zimt28/laravel-pubnub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel PubNub

This is a really light wrapper for the PubNub API. It comes with a simple demo. You can delete controllers/, views/ and routes.php if not needed.

Installation

Just register the bundle

'pubnub' => array(
	'auto'    => true,
	// Want to use the demo?
	'handles' => 'pubnub',
)

Usage

  1. Edit config/pubnub.php
  2. Call PubNub using the IoC Resolver.

You can use use any functionality provided by PubNub.

Publish

IoC::resolve('pubnub')->publish(array(
	'channel' => 'my_channel',
	'message' => array( 'my_var' => 'my text data' )
));

Subscribe

IoC::resolve('pubnub')->subscribe(array(
	'channel ' => 'my_channel',
	'callback' => function($message) {
		var_dump($message['my_var']); // print message
		return true;             // keep listening?
	}
));

History

$messages = IoC::resolve('pubnub')->history(array(
	'channel' => 'my_channel',
	'limit'   => 10
));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published