A library for publishing/subscribing to Nymph database changes.

3.0.0-beta.4 2018-05-04 00:00 UTC


Latest Stable Version Open Issues License

Nymph is an object data store that is easy to use in JavaScript and PHP.


Automatic Setup

The fastest way to start building a Nymph app is with the Nymph App Template.

Nymph App Template

Manual Installation

You can install Nymph PubSub Server with Composer.

composer require sciactive/nymph-pubsub

This repository is the PHP publish/subscribe server. For more information, you can see the main Nymph repository.

Setting up a Nymph PubSub server

Quick Setup with Composer
composer require sciactive/nymph-pubsub
// pubsub.php: Start with `php pubsub.php [-d]`

if (php_sapi_name() != "cli") {
  die("You can only run pubsub.php from the command line.");

// This is an example server that is configured with hostname
// "pubsubnetwork1entry" as an entry point to network1, which contains two
// endpoint servers, "pubsubnetwork1endpoint1" and "pubsubnetwork1endpoint2".

// Setting a default timezome is highly recommended.

require 'vendor/autoload.php';

// Set up Nymph.
use Nymph\Nymph;
  'MySQL' => [
    'host' => 'your_db_host',
    'database' => 'your_database',
    'user' => 'your_user',
    'password' => 'your_password'


// Load all the entities that will be accessible in this server.
require 'MyEntityA.php';
require 'MyEntityB.php';

// Allow this file to be called with "-d" to daemonize it.
if (in_array('-d', $argv)) {
  function shutdown() {
    posix_kill(posix_getpid(), SIGHUP);

  // Switch over to daemon mode.
  if ($pid = pcntl_fork()) {

} else {

// Set up Nymph PubSub.
$config = include(__DIR__.'/config.php');
$config['port'] = 8080;
$config['relays'] = [
$server = new \Nymph\PubSub\Server($config);

// Run the server.
// config.php

// This config file tells Nymph to publish entity updates to these network entry
// points. They will then relay the publish to their network.

return [
  'entries' => [
// somewhere in your Nymph rest endpoint.
$config = include('path/to/pubsub/config.php');

For a thorough step by step guide to setting up Nymph on your own server, visit the Setup Guide.

API Docs

Check out the API Docs in the wiki.