Download the PHP package johnnymast/mysql_websocket_chat without Composer
On this page you can find all versions of the php package johnnymast/mysql_websocket_chat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download johnnymast/mysql_websocket_chat
More information about johnnymast/mysql_websocket_chat
Files in johnnymast/mysql_websocket_chat
Package mysql_websocket_chat
Short Description Quickly get a websocket chat up and running.
License proprietary
Informations about the package mysql_websocket_chat
MYSQL WEBSOCKET CHAT
Welcome to this Hackaton project I created for user hrushi on phpclasses.org. The idea was to create a web socket chat application that could be logging to a database. So here is what you need to get this up and running. Please note the minimum required PHP version is 7.0- this is not because it wanted this but it is because of the dependencies this project has.
Step 1: install composer
First thing you is installing composer on to your system. You can get composer here. Don't worry it might seem intimidating but it is not.
Step 2: Install the project
Using composer
Installing the project using composer is hands down the easiest way to get started. This method will download the project from GitHub and automatically install its dependencies for you. Presuming you installed composer (step 1) execute the following commands on the command-line.
In the above example I am using a mac so my prompt will display different then you if you are on windows.
Downloaded from phpclasses.org
If you download this package in a zip file from phpclasses.org you will have to extract the zip package to a location of your liking. Then change directory into that directory and execute the following command on your prompt.
In the above example I am using a mac so my prompt will display different then you if you are on windows.
Step 3: Configure the server
Websocket configuration
This project can be split into two different components. The WebSocket server is the server.php
in the root directory. The second part
is the frontend part located in public/index.php
. For the WebSocket server, there are two configuration options that you can configure in includes/config.php
.
WEBSOCKET_SERVER_IP
This flag allows you to configure the WebSocket server's IP-address. By default the value 127.0.0.1
has been set.
WEBSOCKET_SERVER_PORT
This will configure what port the WebSocket server will listen on. The default value has been set to 8080
. You can change this
value if it clashes with other services running on your machine.
Database configuration
This server can run either with or without a database. By default i have disabled the use of a database server (ENABLE_DATABASE
) but you can enable it by switching the ENABLE_DATABASE
to true
in the includes/config.php file.
Flag | Description |
---|---|
DATABASE_HOST | The database username goes in here. By default this has been set to root . |
DATABASE_PORT | The database port goes in here. By default this has been set to 3306 . |
DATABASE_USERNAME | The database username goes in here. By default this has been set to root . |
DATABASE_PASSWORD | Enter the password to access the database there. By default this has been set to root . |
DATABASE_DB | Enter the name of the database here. By default this has been set to socket_chat . |
ENABLE_DATABASE | This flag will turn using the database on or off by setting its value to true or false . |
Please note if you enable the database make sure you update the credentials as well (see table above). Also, if you enable the database make sure you have imported database.sql into your database.
Step 4: Fire up the WebSocket server
Change direction into the chat directory and fire up the server.
When you see no output and the command seems to hang that's when you know its running.
Step 5: Point a web service to the public directory
In the chat directory, you will find index.php. This file will be the client for your chat application. Make sure you set any web service its document root to the public/
folder. Alternatively, if you don't have access to a webserver you can also try using PHP's
build-in webserver.
All versions of mysql_websocket_chat with dependencies
fzaninotto/faker Version ^1.7
ext-pdo Version *
squizlabs/php_codesniffer Version *
ext-json Version *