/PHP-Application-Chat-Server

A PHP command line interface application implementing a chat server that uses the WebSocket protocol.

Primary LanguagePHPGNU Lesser General Public License v3.0LGPL-3.0

FlorianWolters\Application\Chat\Server\Server

Build Status

FlorianWolters\Application\Chat\Server is a PHP command line interface application implementing a chat server that uses The WebSocket Protocol.

Access to the shell/command-line is required and a dedicated machine with root access is recommended to run FlorianWolters\Application\Chat\Server.

See FlorianWolters/WebSocket-Chat-Client for a multi-user chat client that is compatible with this chat server.

Features

  • Artifacts tested with both static and dynamic test procedures:

  • Provides a complete Application Programming Interface (API) documentation generated with the documentation generator ApiGen.

    Click here for the current API documentation.

  • Follows the PSR-0 requirements for autoloader interoperability.

  • Follows the PSR-1 basic coding style guide.

  • Follows the PSR-2 coding style guide.

  • Follows the Semantic Versioning Specification (SemVer) 2.0.0-rc.1.

Requirements

Usage

The binary scripts are placed in the folder src/bin:

  • chat-server.php for *-nix operating systems
  • chat-server.cmd for Windows operating systems (simply calls chat-server.php)

Run the following for the general help of the application:

  • *-nix shell

    ./chat-server.php help
  • Windows command-line

    chat-server.cmd help

At this moment, the server only supports the run command. To get help for the run command, run the following:

  • *-nix shell

    ./chat-server.php help run
  • Windows command-line

    chat-server.cmd help run

The following output should be displayed.

Usage:
 run [--logtype="..."] [--loglevel="..."] [--test] [port] [address]

Arguments:
 port        The TCP/IP port to use. (default: 8000)
 address     The IP address to use. (default: 0.0.0.0)

Options:
 --logtype   The type of logger to use (STDOUT, FILE). (multiple values allowed)
 --loglevel  The level for the logger to use (DEBUG, INFO, WARNING, ERROR, CRITICAL, ALERT}). (default: WARNING)
 --test      Run the application in test mode (for automated tests).

Help:
 Runs the chat server on the optionally specified TCP/IP port and the optionally specified IP address.

 The type of the logger (log to STDOUT, log to the file "chat-server.log" or log to both) and the level of the logger can be specified. The default level logs warnings and all levels above.

Installation

Clone the repository into a new directory.

git clone git://github.com/FlorianWolters/PHP-Application-Chat-Server.git

FlorianWolters\Application\Chat\Server should be installed using the dependency manager Composer. Composer can be installed with PHP.

php -r "eval('?>'.file_get_contents('http://getcomposer.org/installer'));"

This will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.

Next, run the install command to resolve and download dependencies:

php composer.phar install

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://gnu.org/licenses/lgpl.txt.