Skip to content

Commit 4d89cff

Browse files
committed
update readme
1 parent f1308e0 commit 4d89cff

File tree

4 files changed

+379
-6
lines changed

4 files changed

+379
-6
lines changed

README.md

Lines changed: 336 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,337 @@
1-
# Addchat Codeigniter API
1+
# AddChat Codeigniter Lite
22

3-
This is API for addchat vuejs app
3+
Welcome to AddChat Codeigniter Lite.
4+
5+
### All-in-one multi-purpose Chat Widget Codeigniter Pacakge
6+
7+
AddChat is a new chatting friend of Codeigniter. It's a standalone Chat widget that uses the website's existing `users` base, and let website users chat with each other.
8+
9+
<br>
10+
11+
You get full source-code, hence AddChat lives and runs on your server/hosting including database. And therefore, you get complete privacy over your data. Either you're a big corporate sector or a small business. AddChat is for everyone.
12+
13+
---
14+
15+
#### Read the documentation live - [AddChat Codeigniter Lite Docs](https://addchat-docs.classiebit.com)
16+
17+
#### Live Preview - [AddChat Codeigniter Lite](https://addchat-codeigniter.classiebit.com)
18+
19+
---
20+
21+
![AddChat Lite - Codeigniter Chat Widget](https://addchat-docs.classiebit.com/images/addchat-docs-banner-1.jpg "AddChat Lite - Codeigniter Chat Widget")
22+
23+
---
24+
25+
> **Here's a complete video tutorial guide for getting started quickly [AddChat Codeigniter Academy](https://classiebit.com/academy/addchat-codeigniter/getting-started) ✌️**
26+
27+
---
28+
29+
## Overview
30+
31+
**Addchat Lite** is a chat widget that you can integrate into an existing or a fresh Codeigniter website. AddChat works like a standalone widget and fulfills all your business-related needs like -
32+
33+
1. User-to-user chatting
34+
2. Live real-time chatting (without page refresh)
35+
3. **Internal** notification system (saves **Pusher** monthly subscription fees)
36+
4. Customer support (<larecipe-badge type="black" circle icon="fa fa-lock"></larecipe-badge> Pro)
37+
5. Multi-user groups (<larecipe-badge type="black" circle icon="fa fa-lock"></larecipe-badge> Pro)
38+
39+
and a lot more features coming up in **AddChat Pro** ⚡️
40+
41+
42+
## Why AddChat ?
43+
44+
Some of the key highlights, why you would like to go with AddChat!
45+
46+
- Save monthly subscription bills (pay once use forever)
47+
- No Confidential Data leak
48+
- Complete Privacy
49+
- Easy to install & update
50+
- Use existing users database
51+
- Multi-purpose, use it as Helpdesk, Customer support, User-to-user chatting and much more...
52+
53+
---
54+
55+
> **AddChat never modifies your existing database tables or records. And it never breaks down any of your website functionality.**
56+
57+
---
58+
59+
> **AddChat is fully tested and ready to be used in production websites.**
60+
61+
---
62+
63+
64+
## Technical Specification
65+
66+
AddChat is very light, high performance, scalable and secure.
67+
68+
1. AddChat front-end built with **VueJs**, which is purely API based web-app.
69+
70+
2. AddChat back-end (API) built with **Codeigniter**
71+
72+
- **AddChat Codeigniter** version comes with an installer, which auto-install AddChat in an existing or a fresh Codeigniter website
73+
74+
75+
76+
## User Interface & Design
77+
78+
AddChat is designed in **CSS Flexbox** and **Sass**. Let's see what's so special about **CSS Flexbox** and why we used it.
79+
80+
1. AddChat is a CSS Framework Independent. Means, no matter in which CSS Framework your website is in, it neither affects the website CSS nor gets affected by it.
81+
82+
- [Bootstrap](https://getbootstrap.com/)
83+
- [Bulma](https://bulma.io/)
84+
- [Materializecss](https://materializecss.com/)
85+
- [Semantic UI](https://semantic-ui.com/)
86+
- [UIKit](https://getuikit.com/)
87+
- [Zurb Foundation](https://foundation.zurb.com/)
88+
89+
or any other...
90+
91+
2. AddChat CSS is completely encapsulated (wrapped in AddChat wrapper with `#addchat-bot .c-` prefix).
92+
- Hence, it never override your website CSS nor inherits from it.
93+
94+
- AddChat UI is extra-responsive. Optimized for **extra-small** devices to large **4K desktops** -
95+
96+
* Small phones
97+
* Android Phones
98+
* iPhones
99+
* iPad & iPad Pro0
100+
* Small-Medium Size Laptops
101+
* Large Desktops
102+
103+
3. We've used the popular **NPM** package `auto-prefixer` to make the AddChat UI design same across all types of browsers e.g `Chrome, Firefox, Safari, Edge` etc
104+
105+
106+
107+
## Multi-regional
108+
109+
AddChat is compatible with all languages and timezones. AddChat auto adapts and adjust website's default timezone and language. Please refer to the Language section for more info about **adding a new language** in [AddChat Codeigniter](/{{route}}/{{version}}/admin/multi-language-codeigniter)
110+
111+
---
112+
113+
> **AddChat never breaks any of your website functionality, even if something went wrong with AddChat, there are `fallback modes` for every worst-case scenario.**
114+
115+
---
116+
117+
118+
## Lite Version
119+
120+
---
121+
122+
> **This is AddChat Lite version documentation**
123+
124+
---
125+
126+
127+
**AddChat Lite** is open-source, free to use. Lite version has got limited features & functionality.
128+
129+
- **AddChat Codeigniter Lite**
130+
131+
+ [Live](https://addchat-codeigniter.classiebit.com) - Visit live.
132+
+ [Github](https://github.com/classiebit/addchat-codeigniter) - Give us a Star.
133+
+ [Download](https://classiebit.com/addchat-codeigniter) - Visit here to download
134+
135+
136+
## Pro Version
137+
138+
**AddChat Pro Version** comes with **Commercial** license. Pro version is fully loaded with a lot of useful and exciting features.
139+
140+
- **AddChat Codeigniter Pro**
141+
142+
+ [Live](https://addchat-codeigniter-pro.classiebit.com) - Coming soon
143+
+ [Purchase](https://classiebit.com/addchat-codeigniter-pro) - Subscribe now for notifications, will be soon available for Purchase here
144+
145+
146+
---
147+
148+
# Codeigniter Installation
149+
150+
AddChat CodeIgniter comes with an installer that makes the installation process fully automated and smooth 🍻
151+
152+
---
153+
154+
![AddChat CodeIgniter Installer](https://addchat-docs.classiebit.com/images/addchat-codeigniter-lite-installer.jpg "AddChat CodeIgniter Installer")
155+
156+
---
157+
158+
> **Here's a complete video tutorial guide for getting started quickly [AddChat CodeIgniter Academy](https://classiebit.com/academy/addchat-codeigniter/getting-started) ✌️**
159+
160+
---
161+
162+
### Server Requirements
163+
164+
* PHP version **5.6** or newer is recommended.
165+
* Make sure **.htaccess** is enabled.
166+
* CodeIgniter website with an **Authentication** (user-login) system.
167+
168+
169+
### Remember
170+
171+
* The website directory must have proper **write** permissions e.g `sudo chown -R :www-data yourwebsite`
172+
* Change CSRF regenerate to `FALSE` in `application/config/config.php` `$config['csrf_regenerate'] = false`
173+
174+
175+
### Install
176+
177+
1. Download & Unzip the package.
178+
2. Copy the **addchat_installer** folder and paste it into your website root directory.
179+
3. After doing so, your website directory will look like this.
180+
181+
```bash
182+
183+
yoursite.com
184+
185+
├── addchat_installer
186+
├── application
187+
├── system
188+
189+
├── ..
190+
├── ..
191+
├── ..
192+
193+
├── .htaccess
194+
└── index.php
195+
196+
```
197+
198+
4. Visit `yoursite.com/addchat_installer` to run the installer.
199+
200+
201+
---
202+
203+
> **Make sure **.htaccess** files exist and not hidden.**
204+
205+
---
206+
207+
> **Do not forget to delete the **addchat_installer** folder after successful installation.**
208+
209+
---
210+
211+
## Installer Instructions
212+
213+
214+
#### Database
215+
216+
- Enter your website's existing database credentials.
217+
218+
<br>
219+
220+
#### Assets
221+
222+
- Enter your website assets folder path.
223+
224+
<br>
225+
226+
#### Config
227+
228+
- Enter your website config folder path. e.g `application/config`
229+
- Enter **LOGGED-IN USER-ID SESSION KEY NAME** e.g user_id
230+
231+
---
232+
233+
> **The $_SESSION variable key name in which your application stores the logged-in user id e.g $_SESSION['user_id'] then the key is *user_id***
234+
235+
---
236+
237+
<br>
238+
239+
#### Application
240+
241+
- Enter **Controllers** Folder Path e.g `application/controllers`
242+
- Enter **Libraries** Folder Path e.g `application/libraries`
243+
- Enter **English Language** Folder Path e.g `application/language/english`
244+
245+
---
246+
247+
> **And finally click install to start the installation process.**
248+
249+
---
250+
251+
252+
### After successful installation, you need to do one simple step manually.
253+
254+
1. Open the common layout file, mostly the common layout file is the file which contains the HTML & BODY tags.
255+
256+
- Copy AddChat CSS code and paste it right before closing **&lt;/head&gt;** tag
257+
258+
```php
259+
<!-- 1. Addchat css -->
260+
<link href="<?php echo base_url('assets/addchat/css/addchat.min.css') ?>" rel="stylesheet">
261+
```
262+
263+
- Copy AddChat Widget code and paste it right after opening **&lt;body&gt;** tag
264+
265+
```php
266+
<!-- 2. AddChat widget -->
267+
<div id="addchat_app"
268+
data-baseurl="<?php echo base_url() ?>"
269+
data-csrfname="<?php echo $this->security->get_csrf_token_name() ?>"
270+
data-csrftoken="<?php echo $this->security->get_csrf_hash() ?>"
271+
></div>
272+
```
273+
274+
- Copy AddChat JS code and paste it right before closing **&lt;/body&gt;** tag
275+
276+
```php
277+
<!-- 3. AddChat JS -->
278+
<!-- Modern browsers -->
279+
<script type="module" src="<?php echo base_url('assets/addchat/js/addchat.min.js') ?>"></script>
280+
<!-- Fallback support for Older browsers -->
281+
<script nomodule src="<?php echo base_url('assets/addchat/js/addchat-legacy.min.js') ?>"></script>
282+
```
283+
284+
<br>
285+
286+
#### The final layout will look something like this
287+
288+
```php
289+
<head>
290+
291+
<!-- **** your site other content **** -->
292+
293+
<!-- 1. Addchat css -->
294+
<link href="<?php echo base_url('assets/addchat/css/addchat.min.css') ?>" rel="stylesheet">
295+
296+
</head>
297+
<body>
298+
299+
<!-- 2. AddChat widget -->
300+
<div id="addchat_app"
301+
data-baseurl="<?php echo base_url() ?>"
302+
data-csrfname="<?php echo $this->security->get_csrf_token_name() ?>"
303+
data-csrftoken="<?php echo $this->security->get_csrf_hash() ?>"
304+
></div>
305+
306+
307+
308+
<!-- **** your site other content **** -->
309+
310+
311+
312+
<!-- 3. AddChat JS -->
313+
<!-- Modern browsers -->
314+
<script type="module" src="<?php echo base_url('assets/addchat/js/addchat.min.js') ?>"></script>
315+
<!-- Fallback support for Older browsers -->
316+
<script nomodule src="<?php echo base_url('assets/addchat/js/addchat-legacy.min.js') ?>"></script>
317+
318+
</body>
319+
```
320+
321+
---
322+
323+
> **Replace the `assets` by your website's assets path.**
324+
325+
---
326+
327+
> **`addchat.min.js` for modern browsers & `addchat-legacy.min.js` for older browsers. These will be used switched by the browsers automatically on the basis on `type="module"` & `nomodule`, you need to nothing.**
328+
329+
---
330+
331+
> **Setup finishes here, now heads-up straight to [Settings](/{{route}}/{{version}}/admin/settings) docs**
332+
333+
---
334+
335+
#### Must read the documentation for getting started - [AddChat Codeigniter Lite Docs](https://addchat-docs.classiebit.com)
336+
337+
---

addchat_installer/index.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,12 @@
202202
<br><br>
203203
<pre class="d-code rounded-lg">
204204
<code data-lang="php">
205-
<strong>
205+
<strong>
206206
&lt;!-- 3. AddChat JS --&gt;
207-
&lt;script src="&lt;?php echo base_url('<?php echo str_replace('/', '', $_POST['assets']) ?>/addchat/js/addchat.min.js') ?&gt;"&gt;&lt;/script&gt;
207+
&lt;!-- Modern browsers --&gt;
208+
&lt;script type="module" src="&lt;?php echo base_url('<?php echo str_replace('/', '', $_POST['assets']) ?>/addchat/js/addchat.min.js') ?&gt;"&gt;&lt;/script&gt;
209+
&lt;!-- Fallback support for Older browsers --&gt;
210+
&lt;script nomodule src="&lt;?php echo base_url('<?php echo str_replace('/', '', $_POST['assets']) ?>/addchat/js/addchat-legacy.min.js') ?&gt;"&gt;&lt;/script&gt;
208211
</strong>
209212

210213
&lt;/body&gt;
@@ -249,7 +252,10 @@
249252

250253
<strong>
251254
&lt;!-- 3. AddChat JS --&gt;
252-
&lt;script src="&lt;?php echo base_url('<?php echo str_replace('/', '', $_POST['assets']) ?>/addchat/js/addchat.min.js') ?&gt;"&gt;&lt;/script&gt;
255+
&lt;!-- Modern browsers --&gt;
256+
&lt;script type="module" src="&lt;?php echo base_url('<?php echo str_replace('/', '', $_POST['assets']) ?>/addchat/js/addchat.min.js') ?&gt;"&gt;&lt;/script&gt;
257+
&lt;!-- Fallback support for Older browsers --&gt;
258+
&lt;script nomodule src="&lt;?php echo base_url('<?php echo str_replace('/', '', $_POST['assets']) ?>/addchat/js/addchat-legacy.min.js') ?&gt;"&gt;&lt;/script&gt;
253259
</strong>
254260

255261
&lt;/body&gt;

addchat_installer/src/libraries/Addchat_lib.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ public function save_settings()
478478
die();
479479
}
480480

481-
if(DEMO_MODE === 1)
481+
if($this->demo_mode())
482482
{
483483
$data = array('status' => false, 'response'=> 'DEMO MODE');
484484
$this->format_json($data);
@@ -768,6 +768,18 @@ private function format_json($data = array())
768768
exit;
769769
}
770770

771+
/**
772+
* Detect demo mode
773+
*/
774+
private function demo_mode()
775+
{
776+
$domain = strtolower($_SERVER['SERVER_NAME']);
777+
if (strpos($domain, 'classiebit.com') !== FALSE || strpos($domain, 'addchat-codeigniter.test') !== FALSE)
778+
return true;
779+
780+
return FALSE;
781+
}
782+
771783

772784
}
773785
/*End Addchat_lib Class*/

0 commit comments

Comments
 (0)