Download the PHP package kaecyra/chatbot without Composer

On this page you can find all versions of the php package kaecyra/chatbot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package chatbot

ChatBot

Packagist Version MIT License

chatbot is a PHP powered asynchronous robot designed to join company instant messaging rooms and provide useful and humorous commands and responses.

ChatBot is extensible, having the ability to load modules that modify and extend core functionality by intercepting events thrown using a simple event manager.

Table of Contents

  1. Installation
  2. HipChat Integration
  3. Usage
  4. Core Commands
    1. Report
    2. List Modules
    3. Load Module
    4. Unload Module
  5. Extending ChatBot
    1. Module Initialization
    2. Hooks
    3. Permissions
    4. Core Events

Installation

ChatBot requires PHP 7.0 or higher and an open port 5222.

Installing ChatBot is as simple as checking out this github repository, or downloading the zip file. Thereafter, copy conf/config.json.tpl to conf/config.json and make changes as needed.

A good place to start is probably adding xmpp.jid and xmpp.pass, and changing the bot's nickname.

HipChat Integration

  1. Create a new admin account and sign in to hipchat.com with it.
  2. Go to {yoursite}.hipchat.com/account/xmpp
  3. Use the Jabber ID (jid) and nick on this page in your bot config.
  4. Start ChatBot. He should connect to your group.
  5. Message ChatBot: join room #room.

Usage

Once the bot is configured, start it using ./chatbot.php start. When the bot is running, you can shut it down by running ./chatbot.php stop. Simple!

ChatBot writes fairly aggressively to a log file, available by default at log/chatbot.log. Logs are rotated after 10mb automatically. Only 1 previous log file is retained.

Core Commands

ChatBot has a core module called base that contains his "core" commands. These facilitate loading and unloading of modules.

Report

Challenge/response method for testing connectivity.

Syntax

chatbot report

Response

<your name>: Reporting in, sir

List Modules

List all available modules.

Specifying either active or enabled somewhere in the line will cause the response to be limited to enabled modules only.

Syntax

chatbot list [active|enabled] modules

Response

Load Module

Load and activate an available module.

Successfully loading a module causes it to be saved to the config file. It will be loaded automatically in the future whenever ChatBot is restarted.

Syntax

chatbot load module <module name>

Response

Loaded: <module name> v<version> by <author> - <description>

Unload Module

Unload and deactive an active module.

Successfully unloading a module causes it to be removed from the config file. It will no longer be automatically loaded on boot.

Syntax

chatbot unload module <module name>

Response

Unloaded: <module name> v<version>

Extending ChatBot

ChatBot supports extension via loadable modules. The ROOT/modules folder is automatically scanned by ChatBot during the boot sequence.

Modules should have their own folder. Inside that folder should be a PHP class file named class.<modulename>.module.php which should contain a PHP class named <ModuleName>Module that extends the module base class \ChatBot\Module.

Module class files should use namespace Module; in order to prevent name conflicts.

Example

Module Initialization

The \ChatBot\Module base class contains a single abstract method, start() which acts as the module constructor. __construct() is private and cannot be directly used.

Hooks

The start() method should be used to define module hooks. A hook definition is simply a callable array tied to an event name.

Example

Multiple hooks can be defined for each event.

Permissions

In order to allow ChatBot to support higher level privileged functions, integration with Orchestration is supported. This integration allows role based permissions to be used for each command.

Each module can define a mapping between roles and granted permissions in its start() method.

Example

This mapping grants the permission base.module.control to users with the Administrator role, and the permission base.report to users with the Staff role.

Core Events

ChatBot has a number of core events that can be hooked out of the box. Combining these events can allow module writers to produce complex workflows.

Event: startup

Fired on startup, after all modules are loaded and just before ChatBot connects to the chat service.

Arguments

No arguments are provided.

Event: tick

Fired every 10 seconds while ChatBot is running.

Arguments

No arguments are provided.

Event: message

Fired every time ChatBot receives any private or groupchat message.

Arguments

Array $event

Event: directed

Fired every time ChatBot receives a private or groupchat message that was directed at the bot. All private messages are considered directed, and groupchat messages that start or end with the bot's name are also considered directed.

Arguments

Array $event

Event: command

Fired when chatbot receives a message that triggers a State-matched command.

Arguments

Array $event


State $state


All versions of chatbot with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
kaecyra/app-common Version ^1.0
vanilla/garden-schema Version ^1.4
vanilla/garden-container Version ^2.0
vanilla/garden-http Version ^1.1
vanilla/garden-cli Version ~1.0
vanilla/garden-daemon Version ^1.0
psr/log Version ^1.0
react/event-loop Version ~0.4
ratchet/pawl Version 0.2.*
react/zmq Version 0.2.*|0.3.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kaecyra/chatbot contains the following files

Loading the files please wait ....