dev-master
9999999-dev
MIT
The Requires
- php >=5.4.0
- illuminate/support 4.2.*
- anlutro/curl dev-master
Wallogit.com
2017 © Pedro Peláez
Openfire Userservice PHP Wrapper, (*1)
require "jestillore/php-openfire-userservice": "dev-master", (*2)
use Jestillore\PhpOpenfireUserservice\PHPOpenfireUserservice;
$us = new PHPOpenfireUserservice;
$us->setEndpoint('http://example.com:9090/plugins/userService');
There are two available authorization type: * HTTP Basic Authentication * Shared Key, (*3)
To use HTTP Basic Authentication, (*4)
$us->setAuthType(PHPOpenfireUserservice::AUTH_BASIC)
->setUsername('username')
->setPassword('password');
To use Shared key, (*5)
$us->setAuthType(PHPOpenfireUserservice::AUTH_SHARED_KEY)
->setSharedKey('thisisthesharedkey');
$us->getAllUsers();
Returns an array of users, (*6)
[
{
"username": "user1",
"name": "User One",
"properties": []
},
{
"username": "user2",
"name": "User Two",
"properties": []
}
]
$us->getUser('username');
Returns user object, (*7)
{
"username": "user1",
"name": "User One",
"email": "user@one.com",
"properties": []
}
$user1 = array(
'username' => 'user1',
'password' => 'password1'
);
$user2 = array(
'username' => 'user2',
'password' => 'password2',
'name' => 'User Two',
'email' => 'user@two.com'
);
$res1 = $us->createUser($user1);
$res2 = $us->createUser($user2);
Returns an instance of Response class., (*8)
if($res1->isSuccess()) {
// account created successfully
}
else {
// account was not created
$res1->getMessage(); // information about the error
}
$res = $us->deleteUser('username');
if ($res->isSuccess()) {
// account deleted
}
else {
// account not deleted
}
$user = array(
'password' => 'password1'
);
$res = $us->updateUser($user);
if($res->isSuccess()) {
// account updated
}
else {
// account not updated
}
$res = $us->lockUser('username');
if($res->isSuccess()) {
// account locked
}
else {
// account not locked
}
$res = $us->unlockUser('username');
if($res->isSuccess()) {
// account unlocked
}
else {
// account not unlocked
}
$groups = $us->getUserGroups('jestillore');
Returns an array of groups, (*9)
[
"group1",
"group2"
]
$groups = array(
'group1',
'group2'
);
$res = $us->addUserToGroups('username', $groups);
if($res->isSuccess()) {
// user added to groups
}
else {
// user not added to groups
}
TODO * Remove user from groups * Get user by property * Get Roster * Add Roster Entry * Delete Roster Entry * Update Roster Entry, (*10)
MIT