1. Go to this page and download the library: Download updivision/xmpp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
updivision / xmpp example snippets
use Updivision\Xmpp\Options;
$options = new Options($address);
$options->setUsername($username)
->setPassword($password);
$options->setLogger($logger)
use Updivision\Xmpp\Client;
$client = new Client($options);
// optional connect manually
$client->connect();
use Updivision\Xmpp\Protocol\Roster;
use Updivision\Xmpp\Protocol\Presence;
use Updivision\Xmpp\Protocol\Message;
// fetch roster list; users and their groups
$client->send(new Roster);
// set status to online
$client->send(new Presence);
// send a message to another user
$message = new Message;
$message->setMessage('test')
->setTo('[email protected]')
$client->send($message);
// join a channel
$channel = new Presence;
$channel->setTo('[email protected]')
->setNickName('mynick');
$client->send($channel);
// send a message to the above channel
$message = new Message;
$message->setMessage('test')
->setTo('[email protected]')
->setType(Message::TYPE_GROUPCHAT);
$client->send($message);
$client->disconnect();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.