Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tanhongit/php_realtime_chat_app
Create a Chat Application using PHP MVC model with MySQL & JavaScript
https://github.com/tanhongit/php_realtime_chat_app
chat-application chat-realtime chatapp mysql php php-chat-app php-mvc realtime tanhongit tanhongit-mvc
Last synced: 26 days ago
JSON representation
Create a Chat Application using PHP MVC model with MySQL & JavaScript
- Host: GitHub
- URL: https://github.com/tanhongit/php_realtime_chat_app
- Owner: tanhongit
- License: mit
- Created: 2022-02-04T04:08:29.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-02T09:38:53.000Z (almost 2 years ago)
- Last Synced: 2024-10-09T20:36:51.170Z (about 1 month ago)
- Topics: chat-application, chat-realtime, chatapp, mysql, php, php-chat-app, php-mvc, realtime, tanhongit, tanhongit-mvc
- Language: PHP
- Homepage:
- Size: 3.23 MB
- Stars: 14
- Watchers: 1
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Welcome to PHP Realtime Chat App MVC Model by TanHongIT
Create a Chat Application using PHP MVC model with MySQL & JavaScript.## This source structure is cloned from project: [`yl-mvc-structure`](https://github.com/TanHongIT/yl-mvc-structure)
# 1. Configuration requirements
- Version PHP 7.2 and above
- OpenSSL PHP Extension# 2. Technology
- Pure PHP language
- Using MVC model
- Javascript# 3. Setup assets folder
This Project is using webpack in order to compile Javascript modules and compile Sass/SCSS files to css. Run the following commands in the project's asset directory:
Run:
```shell
cd public/frontend/assets
npm install
npm run build
```# 4. Download Database
This is the path to the database file for you to download: [`/database/***.sql`](https://github.com/TanHongIT/PHP_Realtime_Chat_App/tree/main/database)
Create a new database on **PHPMyAdmin** at your server (or any other database connection tool), then import the .sql file that you just downloaded.
# 5. Edit Connect Database
You need to change the connection information to the database after you have cloned my repository so that the website can work.
Path: [`/config/database.php`](https://github.com/TanHongIT/PHP_Realtime_Chat_App/tree/main/config)
This is the path to the database file for you to download: [`/database/***.sql`](https://github.com/TanHongIT/PHP_Realtime_Chat_App/tree/main/database)
```php
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', 'root');
define('DB_NAME', 'chatapp-php');
```And then run to import database
```shell
mysql -u root -p chatapp-php < YOUR-PATH/PHP_Realtime_Chat_App/database/chatapp-php.sql
```
Please change **YOUR-PATH** to your project's path.# 6. Install and using ssl certificate
Using mkcert to create ssl certificate### For Ubuntu
```shell
sudo apt install libnss3-toolssudo wget https://github.com/FiloSottile/mkcert/releases/download/v1.4.3/mkcert-v1.4.3-linux-amd64 && \
sudo mv mkcert-v1.4.3-linux-amd64 mkcert && \
sudo chmod +x mkcert && \
sudo cp mkcert /usr/local/bin/
```Now that the mkcert utility is installed, run the command below to generate and install your local CA:
```shell
mkcert -install
```### Create ssl certificate for this project
Run:
```shell
cd /var/www/certs
mkcert local.php_realtime_chat_app.com
```And then change **local.PHP_Realtime_Chat_App.com.conf** file (/apache2/sites-available/ to this)
```
ServerAdmin localserver@localhost
ServerName local.PHP_Realtime_Chat_App.com
ServerAlias www.PHP_Realtime_Chat_App.vdx.com
DocumentRoot /var/www/PHP_Realtime_Chat_App
ErrorLog /var/www/logs/error-PHP_Realtime_Chat_App.log
CustomLog /var/www/logs/access-PHP_Realtime_Chat_App.log combinedServerAdmin localserver@localhost
ServerName local.PHP_Realtime_Chat_App.com
ServerAlias www.local.PHP_Realtime_Chat_App.com
DocumentRoot /var/www/PHP_Realtime_Chat_AppErrorLog /var/www/logs/error-PHP_Realtime_Chat_App.log
CustomLog /var/www/logs/access-PHP_Realtime_Chat_App.log combinedSSLEngine on
SSLCertificateFile /var/www/certs/local.PHP_Realtime_Chat_App.com.pem
SSLCertificateKeyFile /var/www/certs/local.PHP_Realtime_Chat_App.com-key.pem
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
```
# 7. Demo
Demo account:
```
Email: [email protected]
Pass: 123456
```