• This repository has been archived on 10/Jan/2022
  • Stars
    star
    179
  • Rank 214,039 (Top 5 %)
  • Language
    PHP
  • License
    Other
  • Created almost 11 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Library for XMPP protocol connections (Jabber) for PHP

fabiang/xmpp

Library for XMPP protocol connections (Jabber) for PHP.

License Latest Stable Version Total Downloads Dependency Status Build Status Coverage Status Scrutinizer Quality Score SensioLabsInsight

SYSTEM REQUIREMENTS

  • PHP minimum 5.6 or minimum 7.0
  • psr/log
  • (optional) psr/log-implementation - like monolog/monolog for logging

INSTALLATION

New to Composer? Read the introduction. Add the following to your composer file:

composer require fabiang/xmpp

DOCUMENTATION

This library uses an object to hold options:

use Fabiang\Xmpp\Options;
$options = new Options($address);
$options->setUsername($username)
    ->setPassword($password);

The server address must be in the format tcp://myjabber.com:5222.
If the server supports TLS the connection will automatically be encrypted.

You can also pass a PSR-2-compatible object to the options object:

$options->setLogger($logger)

The client manages the connection to the Jabber server and requires the options object:

use Fabiang\Xmpp\Client;
$client = new Client($options);
// optional connect manually
$client->connect();

For sending data you just need to pass a object that implements Fabiang\Xmpp\Protocol\ProtocolImplementationInterface:

use Fabiang\Xmpp\Protocol\Roster;
use Fabiang\Xmpp\Protocol\Presence;
use Fabiang\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]')
    ->setPassword('channelpassword')
    ->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);

After all you should disconnect:

$client->disconnect();

DEVELOPING

If you like this library and you want to contribute, make sure the unit-tests and integration tests are running. Composer will help you to install the right version of PHPUnit and Behat.

composer install

After that:

./vendor/bin/phpunit
./vendor/bin/behat

New features should always tested with Behat.

LICENSE

BSD-2-Clause. See the LICENSE.

TODO

  • Better integration of channels
  • Factory method for server addresses
  • improve documentation

More Repositories

1

true-combat

Enemy Territory + True Combat:Elite
HTML
13
star
2

docker-sqlcmd

Sqlcmd – command line tool for Microsoft SQL Server (Docker image).
Dockerfile
8
star
3

doctrine-dynamic

Load Doctrine mappings dynamically for your entities by configuration
PHP
7
star
4

docker-guetzli

Docker container for Googles Perceptual JPEG encoder Guetzli.
Dockerfile
6
star
5

gitty

Gitty is a web-based deployment tool for git written in PHP
PHP
6
star
6

docker-go-sqlcmd

Modern command line tool written in Go for Microsoft SQL Server as Docker image
Dockerfile
5
star
7

ckeditor5-deepl-plugin

CKEditor plugin that integrates Deepl translation engine
JavaScript
5
star
8

docker-wix3

WiX Toolset v3 for creating MSI installers (Docker Image)
Dockerfile
3
star
9

doctrine-migrations-liquibase-laminas

Laminas module for creating changesets for Liquibase with Doctrine
PHP
3
star
10

dateparser

Date parsing library supporting the full format RFC3339
PHP
2
star
11

cludearg

Normalizer library for command line arguments for in- or exclude paths and files
PHP
2
star
12

lzw

Compression library for Lempel–Ziv–Welch (LZW) for PHP
PHP
2
star
13

zend-pwnedpasswords

Validator for the Zend Framework for pwnedpasswords.com API: https://haveibeenpwned.com/API/v2#PwnedPasswords
PHP
2
star
14

doctrine-dynamic-laminas

Laminas binding for doctrine-dynamic
PHP
2
star
15

sid

Converter for Security Identifiers (SID)
Go
2
star
16

docker-ldap-utils

Openldap's utils with GSSAPI support
1
star
17

docker-lazarus

Freepascal (fpc) compiler + Lazarus project libraries as Docker image
Dockerfile
1
star
18

docker-liquibase

Liquibase with PostgreSQL, MySQL and SQLServer (+Liquibase Extension) support
Dockerfile
1
star
19

assetic-google-closure-compiler

Google Closure Compiler for the PHP assetic library (Java/JAR version)
PHP
1
star
20

docker-diff-to-html

Display diffs in a convenient html page (Docker image)
Dockerfile
1
star
21

doctrine-switch-connection

Laminas & Zend Framework module to switch the DB connection depending on a session value
PHP
1
star
22

docker-rewinged

Docker Image for rewinged – a self-hosted winget package source
Dockerfile
1
star
23

docker-pdepend

PHP_Depend is an adaptation of the established Java development tool JDepend. This tool shows you the quality of your design in terms of extensibility, reusability and maintainability. (DOCKER IMAGE)
Dockerfile
1
star
24

laminas-localize-helper

Laminas module for setting locale to all view helpers, validators and filters
PHP
1
star