2017 © Pedro Peláez
 

library xmpp

A client library for talking to XMPP servers.

image

deminy/xmpp

A client library for talking to XMPP servers.

  • Tuesday, March 10, 2015
  • by deminy
  • Repository
  • 4 Watchers
  • 9 Stars
  • 406 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 3 Versions
  • 3 % Grown

The README.md

Summary

Before creating this repository, I've evaluated following XMPP libraries for PHP:, (*1)

Unfortunately, none of above ships with what I need. That's the reason I'm creating this repository based on Nikita's work., (*2)

Features

  • Following features were shipped already from Nikita's fork:
    • Connects to and authenticates (using DIGEST-MD5) against XMPP servers (tested against Openfire and jabberd2)
    • Supports SSL/TLS connections
    • Allows joining of MUC rooms
    • Sends messages to individuals and MUC rooms.
  • Following features are added by me, plus various refactoring, etc:
    • Connects to and authenticates using PLAIN.
    • XEP-0045 (Multi-User Chat) related implementations, including to create chatroom, destroy chatroom, grant member, revoke member and get member list.

Sample Code

use Xmpp\Xep\Xep0045 as xmpp;

$roomId = 'YourHouse';
$userId = 'Tom';

$options = array(
    'username'  => 'your_username',
    'password'  => 'your_password',
    'host'      => 'example.com',
    'ssl'       => false,
    'port'      => 5222,
    'resource'  => uniqid('', true),
    'mucServer' => 'conference.example.com', // optional
);
$xmpp = new xmpp($options, $logger);

$xmpp->createRoom($roomId);            // Create the room.
$xmpp->grantMember($roomId, $userId);  // Add a member to the room.
$xmpp->getMemberList($roomId);         // Get member list and there should be only one member.
$xmpp->revokeMember($roomId, $userId); // Remove the only member out from the room.
$xmpp->getMemberList($roomId);         // Get member list and there should be nobody in the room.
$xmpp->destroyRoom($roomId);           // Destroy the room.
$xmpp->disconnect();                   // Disconnect from the server. Important for heavy-loaded servers.

Known Limitations

  • Only part of XEP-0045 (Multi-User Chat) protocol extension have been implemented.
  • Although code was refactored/written following FIG PSR standards, it was developped and tested for certain project under certain environment only.

Credits

  • Nikita's fork.
  • Valuable suggestions, helps on performance improments and tests from colleague Jose (known to all as Tachu), Jakub and Jerry.

License

MIT license., (*3)

The Versions

10/03 2015

dev-master

9999999-dev

A client library for talking to XMPP servers.

  Sources   Download

MIT

The Requires

 

php xmpp jabber im

16/12 2014

0.0.2

0.0.2.0

A client library for talking to XMPP servers.

  Sources   Download

MIT

The Requires

 

php xmpp jabber im

12/12 2014

0.0.1

0.0.1.0

A client library for talking to XMPP servers.

  Sources   Download

MIT

The Requires

 

php xmpp jabber im