quadrogod/laravel-ejabberd

Ejabbered API Wrapper for Laravel/lumen

0.1.0 2018-12-03 23:00 UTC

This package is auto-updated.

Last update: 2024-12-15 20:07:04 UTC


README

Ejabberd API

Installation

composer require kevin-kibet/laravel-ejabberd

Configuration

You can publish the configuration file using this command

$ php artisan vendor:publish --provider="Ejabberd\Providers\EjabberdServiceProvider"

<?php

return [
    'api' => env('EJABBERD_API', 'http://im.conversations.com/api'),
    
    'domain' => env('EJABBERD_DOMAIN', 'conversations.com'),
    'conference_domain' => env('EJABBERD_CONFERENCE_DOMAIN', 'conference.conversations.com'),
    'user' => env('EJABBERD_USER', 'admin'),
    'password' => env('EJABBERD_PASSWORD', 'password'),
    'debug' => env('EJABBERD_DEBUG', true)
];

Laravel

Register the service provider: In your config/app.php

'providers' => [
    // Other Service Providers

    Ejabberd\Providers\EjabberdServiceProvider::class
],

Lumen

To load the configuration, in your bootstrap/app.php

$app->configure('ejabberd')

Register the service provider

$app->register(Ejabberd\Providers\EjabberdServiceProvider::class);

Examples

Create user

Register a new user to your xmpp server

$create_user = new CreateUser($user, $password, $host);
$response = EjabberedFacade::createUser($create_user);

Send message

Send message to a user or conference

$send_message = new SendMessage($type, $from, $to, $subject, $body);
$response = EjabberedFacade::sendMessage($send_message);