jayswalvishwas / jaxl

Automatically exported from code.google.com/p/jaxl
Other
0 stars 0 forks source link

JAXL (Jabber XMPP Client and Component Library in PHP)

Jaxl v3.x is out. It's fast, modular, clean, flexible, oops, event based. Read More

Jaxl 2.x is an object oriented XMPP framework in PHP for developing real time applications for browsers, desktops and hand held devices. Jaxl 2.x is a robust, flexible and easy to use version of Jaxl 1.x series which was hosted at google code.

Download

Warning: The development source code at Github is only intended for people that want to develop Jaxl or absolutely need the latest features still not available on the stable releases.

Writing XMPP apps using JAXL library

Here is how a simple send chat message app looks like using Jaxl library:

// Include and initialize Jaxl core
require_once '/path/to/jaxl/core/jaxl.class.php';
$jaxl = new JAXL(array(
    'user'=>'username',
    'pass'=>'password',
    'host'=>'talk.google.com',
    'domain'=>'gmail.com',
    'authType'=>'PLAIN',
    'logLevel'=>5
));

// Send message after successful authentication
function postAuth($payload, $jaxl) {
    global $argv;
    $jaxl->sendMessage($argv[1], $argv[2]);
    $jaxl->shutdown();
}

// Register callback on required hook (callback'd method will always receive 2 params)
$jaxl->addPlugin('jaxl_post_auth', 'postAuth');

// Start Jaxl core
$jaxl->startCore('stream');

Run from command line:

php sendMessage.php "anotherUser@gmail.com" "This is a test message"

Useful Links

Generate Jaxl documentation on your system for quick reference:

phpdoc -o HTML:Smarty:PHP -ti "JAXL Documentation" -t /var/www/ -d xmpp/,xep/,env/,core/