This is a basic shoutboard built using CodeIgniter. Originally only used XML for the backend, but was rewritten to illustrate different types of web services. The application has been migrated from CodeIgniter 3.1.0 to CodeIgniter 4.
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure. More information can be found at the official site.
PHP version 8.1 or higher is required, with the following extensions installed:
- intl
- mbstring
- json (enabled by default - don't turn it off)
- mysqlnd for MySQL database
- libcurl if you plan to use the HTTP\CURLRequest library
-
Clone the repository:
git clone git@github.com:llbbl/codeigniter-chat.git
-
Install PHP dependencies:
composer install
-
Install Node.js dependencies (for front-end build system):
npm install
-
Build front-end assets:
npm run build
-
Database Configuration:
- Edit
app/Config/Database.php
to include your MySQL connection details:public array $default = [ 'hostname' => 'localhost', 'username' => 'your_mysql_username', 'password' => 'your_mysql_password', 'database' => 'your_database_name', 'DBDriver' => 'MySQLi', // Other settings can remain as default ];
- Run the
create.sql
script to create the necessary tables in your database
- Edit
-
Environment Configuration:
- Copy the
env
file to.env
and configure it for your environment:cp env .env
- Edit the
.env
file to set the appropriate values:CI_ENVIRONMENT = development app.baseURL = 'http://your-domain.com/'
- Copy the
Configure your web server to point to the public
folder as the document root.
If you are using Apache, there is already a .htaccess
file in the public folder. Make sure you have mod_rewrite enabled.
If you are using Nginx, use a configuration similar to:
server {
server_name your-domain.com;
root /path/to/codeigniter-chat/public;
listen 80;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm.sock; # Adjust this path as needed
fastcgi_read_timeout 150;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Start your web server and navigate to:
- XML Chat:
http://your-domain.com/chat
- JSON Chat:
http://your-domain.com/chat/json
- HTML Chat:
http://your-domain.com/chat/html
If you encounter any issues:
- Check the error logs in
writable/logs/
- Ensure your database configuration is correct
- Make sure your web server is configured correctly
- Verify that the database tables have been created properly
This project uses Vite as a front-end build system to process CSS and JavaScript files.
To start the development server:
npm run dev
This will start a development server at http://localhost:5173/ that will automatically reload when you make changes to the source files.
To build the assets for production:
npm run build
This will generate optimized files in the public/dist/
directory.
For more detailed information about the front-end build system, please refer to the src/README.md file.
For detailed information about the migration from CodeIgniter 3 to CodeIgniter 4, please refer to the README_MIGRATION.md file.