mrferos / zulip-php
PHP Zuilip Client
Installs: 10 299
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 4
Forks: 2
Open Issues: 2
Requires
- ext-json: *
- guzzlehttp/guzzle: ^6.5
- psr/log: ^1.1
This package is auto-updated.
Last update: 2024-12-06 10:07:14 UTC
README
I am working on a V2 of the client that is more up to date and is actually tested to work, please see the v2 branch for updates
Have been playing around with Zulip and noticed there was no PHP client... So I made one!
Installation
Using composer!
composer require mrferos/zulip-php:^0.1.0
Usage:
Using the client is simple, instantiate it with the URL to your Zulip instance and pass the default authentication object (on a per request basis you can specify different authentication in case you need/want to send messages as different users per requests).
Example:
<?php require_once __DIR__ . '/vendor/autoload.php'; $client = new \Zulip\Client('http://localhost:9991'); $client->setDefaultAuthentication(new \Zulip\Authentication('feedback@zulip.com', '7Rp5bNRVz1dSuDz4HhANaxlpNDcYb6GQ')); $client->sendMessage([ 'to' => 'Denmark', 'content' => 'content', 'type' => \Zulip\Request\MessageParameters::TYPE_STREAM, 'subject' => 'subject' ]); // or.. (this is what happens under the code if you pass an array) $parameters = new \Zulip\Request\MessageParameters(); $parameters->setContent('Content of message'); $parameters->setTo('Denmark'); $parameters->setType(\Zulip\Request\MessageParameters::TYPE_STREAM); $parameters->setSubject('This is the subject'); $client->sendMessage($parameters);
TODO:
- Write tests
- Implement the rest of the API
- More documentation!