PHP Classes

How to Use a PHP WebSockets Server to Create a Char Bot that Responds Automatically to User Messages Using the Package PHP WebSockets: Implement a chatbot using WebSockets

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-04-21 (9 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
phpwebsocket 1.0.0MIT/X Consortium ...5PHP 5, Web services, Chat, Artificial...
Description 

Author

This package can implement a chatbot using WebSockets.

It provides a WebSockets server class that can listen for connections on a given host name and port and call class functions to process the events of communication between the Web Sockets client and server.

A chatbot class extends the WebSockets server class to implement functions to interact with clients by reacting to given text entered in the chat by the users.

Currently, it can respond to text messages that have words like:

- hello

- hi

- name

- age

- date

- time

- thanks

- bye

Innovation Award
PHP Programming Innovation award nominee
April 2025
Nominee
Vote
Chatbots are useful to provide automated support to users of a Website.

This package implements a Chatbot using Web sockets to let users of a site interact with a robot implemented using a PHP class that provides automated responses to user requests.

Manuel Lemos
Picture of Chun-Sheng, Li
  Performance   Level  
Name: Chun-Sheng, Li <contact>
Classes: 41 packages by
Country: Taiwan Taiwan
Innovation award
Innovation award
Nominee: 18x

Winner: 1x

Instructions

Please check this example script to learn how to create a chat bot using WebSockets.

Example

#!/php -q
<?php
// Run from command prompt > php -q websocket.demo.php

// Basic WebSocket demo echoes msg back to client
include "websocket.class.php";
$master = new WebSocket("localhost",12345);


Details

phpwebsocket

Automatically exported from code.google.com/p/phpwebsocket

About Project

This is forked form google code.


  Files folder image Files (6)  
File Role Description
Files folder image phpwebsocket (5 files)
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (6)  /  phpwebsocket  
File Role Description
  Plain text file chatbot.demo.php Class Class source
  Accessible without login HTML file client.html Doc. Documentation
  Plain text file server.php Class Class source
  Plain text file websocket.class.php Class Class source
  Accessible without login Plain text file websocket.demo.php Example Example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 100%
Total:0
This week:0