synchrotalk / meteor-ddp-php
DDP client for PHP
dev-refactor
2016-09-20 20:57 UTC
Requires
- monolog/monolog: ~1.2
- textalk/websocket: ~1.2
Requires (Dev)
- synchrotalk/websocket: dev-master
This package is not auto-updated.
Last update: 2025-01-18 22:25:26 UTC
README
A minimalist PHP library that implements DDP client, the realtime protocol for Meteor framework.
How to use
Suppose you have declared a remote function foo
in your meteor server code :
Meteor.methods({ foo : function (arg) { check(arg, Number); if (arg == 1) { return 42; } return "You suck"; } });
Then in your php client's code, you could just invoke foo
by executing :
use synchrotalk\MeteorDDP\DDPClient; $client = new DDPClient('localhost', 3000); $client->connect(); $client->call("foo", array(1)); while(($a = $client->getResult("foo")) === null) {}; echo 'Result = ' . $a . PHP_EOL; $client->stop();
===>
Result = 42
More use cases can be found in the examples folder.
How to install
This library is available via composer, the dependency manager for PHP. Please add this in your composer.json :
"require" : { "synchrotalk/meteor-ddp-php": "0.1.0" }
and update composer to automatically retrieve the package :
php composer.phar update
Roadmap
None
Version
0.1.0