sciactive / nymph-pubsub
该软件包已被废弃且不再维护。没有建议的替代软件包。
用于发布/订阅 Nymph 数据库变化的库。
3.0.2
2019-06-28 00:00 UTC
Requires
- cboden/ratchet: 0.4.*
- ratchet/pawl: ^0.3.4
- sciactive/hookphp: ^2.0
- sciactive/nymph-server: ^3.2
- zendframework/zend-log: 2.*
Requires (Dev)
- dev-master
- 3.0.2
- 3.0.1
- 3.0.0
- 3.0.0-beta.9
- 3.0.0-beta.8
- 3.0.0-beta.7
- 3.0.0-beta.6
- 3.0.0-beta.5
- 3.0.0-beta.4
- 3.0.0-beta.3
- 3.0.0-beta.2
- 3.0.0-beta.1
- 2.2.1
- 2.2.0
- 1.6.0
- 1.5.5
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.4.0-beta.4
- 1.4.0-beta.3
- 1.4.0-beta.2
- dev-dependabot/composer/guzzlehttp/psr7-1.8.5
- dev-dependabot/composer/symfony/http-foundation-4.4.29
- dev-dependabot/composer/symfony/mime-4.4.27
This package is auto-updated.
Last update: 2022-12-11 18:40:31 UTC
README
用于协作网络应用的强大对象数据存储和查询。
弃用通知
Nymph/Tilmeld 的 PHP 实现已被弃用。它将不再添加任何新功能。取而代之的是,将使用 TypeScript 编写的 Node.js 新版本 Nymph 替换 PHP 实现。您可以在 Nymph.js 仓库 中找到它。
安装
自动设置
开始构建 Nymph 应用最快的方法是使用 Nymph 应用模板。
手动安装
composer require sciactive/nymph-pubsub
该仓库是 PHP 发布/订阅服务器。有关更多信息,请参阅 主要 Nymph 仓库。
用法
// 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. date_default_timezone_set('America/Los_Angeles'); require 'vendor/autoload.php'; // Set up Nymph. use Nymph\Nymph; Nymph::configure([ 'MySQL' => [ 'host' => 'your_db_host', 'database' => 'your_database', 'user' => 'your_user', 'password' => 'your_password' ] ]); \Nymph\Nymph::connect(); // 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()) { return; } register_shutdown_function('shutdown'); } else { error_reporting(E_ALL); } // Set up Nymph PubSub. $config = include(__DIR__.'/pubsub-config.php'); $config['port'] = 8080; $config['relays'] = [ 'ws://pubsubnetwork1endpoint1:8080/', 'ws://pubsubnetwork1endpoint2:8080/' ]; $server = new \Nymph\PubSub\Server($config); // Run the server. $server->run();
// pubsub-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' => [ 'ws://pubsubnetwork1entry:8080/', 'ws://pubsubnetwork2entry:8080/', 'ws://pubsubnetwork3entry:8080/' ] ];
// somewhere in your Nymph rest endpoint. $config = include('path/to/pubsub/pubsub-config.php'); \Nymph\PubSub\Server::configure($config);
有关在您的服务器上设置 Nymph 的详细步骤指南,请访问 设置指南。
API 文档
查看维基中的 API 文档。