2017 © Pedro Peláez
 

library pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

image

fanout/pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  • Tuesday, May 23, 2017
  • by kon
  • Repository
  • 4 Watchers
  • 0 Stars
  • 27,314 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 15 Versions
  • 6 % Grown

The README.md

php-pubcontrol

Author: Konstantin Bokarius kon@fanout.io, (*1)

EPCP library for PHP., (*2)

License

php-pubcontrol is offered under the MIT license. See the LICENSE file., (*3)

Requirements

  • openssl
  • curl
  • pthreads (required for asynchronous publishing)
  • firebase/php-jwt >=1.0.0 (retreived automatically via Composer)

Installation

Using Composer: 'composer require fanout/pubcontrol', (*4)

Manual: ensure that php-jwt has been included and require the following files in php-pubcontrol:, (*5)

require 'php-pubcontrol/src/format.php';
require 'php-pubcontrol/src/item.php';
require 'php-pubcontrol/src/pubcontrolclient.php';
require 'php-pubcontrol/src/pubcontrol.php';

Asynchronous Publishing

In order to make asynchronous publish calls pthreads must be installed. If pthreads is not installed then only synchronous publish calls can be made. To install pthreads recompile PHP with the following flag: '--enable-maintainer-zts', (*6)

Also note that since a callback passed to the publish_async methods is going to be executed in a separate thread, that callback and the class it belongs to are subject to the rules and limitations imposed by the pthreads extension., (*7)

See more information about pthreads here: http://php.net/manual/en/book.pthreads.php, (*8)

Usage

body = $body;
    }

    function name()
    { 
        return 'http-response';
    }

    function export()
    {
        return array('body' => $this->body);
    }
}

function callback($result, $message)
{
    if ($result)
        Print "Publish successful\r\n";
    else
        Print "Publish failed with message: {$message}\r\n";
}

// PubControl can be initialized with or without an endpoint configuration.
// Each endpoint can include optional JWT authentication info.
// Multiple endpoints can be included in a single configuration.

// Initialize PubControl with a single endpoint:
$pub = new PubControl\PubControl(array(
        'uri' => 'https://api.fanout.io/realm/',
        'iss' => '', 'key' => base64_decode('')));

// Add new endpoints by applying an endpoint configuration:
$pub->apply_config(array(array('uri' => ''), 
        array('uri' => '')));

// Remove all configured endpoints:
$pub->remove_all_clients();

// Explicitly add an endpoint as a PubControlClient instance:
$pubclient = new PubControl\PubControlClient('');
// Optionally set JWT auth: $pubclient->set_auth_jwt(, '');
// Optionally set basic auth: $pubclient->set_auth_basic('', '');
$pub->add_client($pubclient);

// Publish across all configured endpoints synchronously:
$pub->publish('', new PubControl\Item(
        new HttpResponseFormat("Test publish!")));

// Use publish_async for async publishing only if pthreads are installed:
// if ($pub->is_async_supported())
//     $pub->publish_async('', new PubControl\Item(
//     new HttpResponseFormat("Test async publish!")));
// Wait for all async publish calls to complete:
// $pub->finish();
?>

The Versions

23/05 2017

dev-master

9999999-dev https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Konstantin Bokarius

23/05 2017

dev-develop

dev-develop https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Konstantin Bokarius

23/05 2017

2.3.0

2.3.0.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Konstantin Bokarius

24/05 2016

2.2.0

2.2.0.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Konstantin Bokarius

21/04 2015

2.0.0

2.0.0.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Konstantin Bokarius

21/04 2015

2.1.0

2.1.0.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Konstantin Bokarius

02/04 2015

1.0.9

1.0.9.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Konstantin Bokarius

09/02 2015

1.0.8

1.0.8.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

by Konstantin Bokarius

01/02 2015

1.0.7

1.0.7.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

by Konstantin Bokarius

20/01 2015

1.0.6

1.0.6.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

by Konstantin Bokarius

19/01 2015

1.0.5

1.0.5.0 https://github.com/fanout/php-pubcontrol

A PHP convenience library for publishing messages using the EPCP protocol.

  Sources   Download

MIT

The Requires

 

by Konstantin Bokarius

17/01 2015

1.0.4

1.0.4.0 https://github.com/fanout/php-pubcontrol

EPCP library for PHP.

  Sources   Download

MIT

The Requires

 

by Konstantin Bokarius

17/01 2015

1.0.2

1.0.2.0 https://github.com/fanout/php-pubcontrol

EPCP library for PHP.

  Sources   Download

MIT

The Requires

 

by Konstantin Bokarius

17/01 2015

1.0.1

1.0.1.0 https://github.com/fanout/php-pubcontrol

EPCP library for PHP.

  Sources   Download

MIT

The Requires

 

by Konstantin Bokarius

17/01 2015

1.0.0

1.0.0.0 https://github.com/fanout/php-pubcontrol

EPCP library for PHP.

  Sources   Download

MIT

The Requires

 

by Konstantin Bokarius