workerman/stomp

Maintainers

👁 workerman

Package info

github.com/walkor/stomp

Homepage

pkg:composer/workerman/stomp

Statistics

Installs: 10 734

Dependents: 6

Suggesters: 0

Stars: 10

Open Issues: 3

v1.0.9 2024-01-17 08:49 UTC

Requires

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 07e6b38b0dc488cbc715a306be2ccef391010744

This package is auto-updated.

Last update: 2026-06-17 14:06:05 UTC


README

Asynchronous STOMP client for PHP based on workerman.

Installation

composer require workerman/stomp

Example

test.php

<?php
require __DIR__ . '/../vendor/autoload.php';
use Workerman\Worker;
use Workerman\Timer;
use Workerman\Stomp\Client;

$worker = new Worker();
$worker->onWorkerStart = function(){
 $client = new Workerman\Stomp\Client('stomp://127.0.0.1:61613', array(
 'debug' => true,
 ));
 $client->onConnect = function(Client $client) {
 $client->subscribe('/topic/foo', function(Client $client, $data) {
 var_export($data);
 });
 };
 $client->onError = function ($e) {
 echo $e;
 };
 Timer::add(1, function () use ($client) {
 $client->send('/topic/foo', 'Hello Workerman STOMP');
 });
 $client->connect();
};
Worker::runAll();

Run with command php test.php start

License

MIT