Skip to content

Commit 740c016

Browse files
committed
Readme and Documentation has been updated.
1 parent 18dde4d commit 740c016

File tree

3 files changed

+483
-475
lines changed

3 files changed

+483
-475
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
[![Latest Version on Packagist][ico-version]][link-packagist]
2+
[![Total Downloads][ico-downloads]][link-downloads]
3+
14
# CodeIgniter WebSocket Library
2-
CodeIgniter library realtime communication by using Websocket technology and Ratchet ([Socketo.me](http://socketo.me) & [ratchet_client](https://github.com/romainrg/ratchet_client))
5+
CodeIgniter WebSocket library. It allows you to make powerfull realtime applications by using Ratchet ([Socketo.me](http://socketo.me) & [ratchet_client](https://github.com/romainrg/ratchet_client)) Websocket technology.
36

47
If you Face any problem you may check CodeIgniter WebSocket Example https://github.com/takielias/codeigniter-websocket-example
58

@@ -119,4 +122,11 @@ Be free to open an issue or send pull request
119122
## Support on Beerpay
120123
Hey dude! Help me out for a couple of :beers:!
121124

122-
[![Beerpay](https://beerpay.io/takielias/codeigniter-websocket/badge.svg?style=beer-square)](https://beerpay.io/takielias/codeigniter-websocket) [![Beerpay](https://beerpay.io/takielias/codeigniter-websocket/make-wish.svg?style=flat-square)](https://beerpay.io/takielias/codeigniter-websocket?focus=wish)
125+
[![Beerpay](https://beerpay.io/takielias/codeigniter-websocket/badge.svg?style=beer-square)](https://beerpay.io/takielias/codeigniter-websocket) [![Beerpay](https://beerpay.io/takielias/codeigniter-websocket/make-wish.svg?style=flat-square)](https://beerpay.io/takielias/codeigniter-websocket?focus=wish)
126+
127+
[ico-version]: https://img.shields.io/packagist/v/takielias/codeigniter-websocket.svg?style=flat-square
128+
[ico-downloads]: https://img.shields.io/packagist/dt/takielias/codeigniter-websocket.svg?style=flat-square
129+
130+
[link-packagist]: https://packagist.org/packages/takielias/codeigniter-websocket
131+
[link-downloads]: https://packagist.org/packages/takielias/codeigniter-websocket
132+
[link-author]: https://github.com/takielias

helpers/codeigniter_websocket_helper.php

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,67 +5,67 @@
55
* Date: 04/05/2019
66
* Time: 09:04 PM
77
*/
8-
defined('BASEPATH') or exit('No direct script access allowed');
98

109
/**
10+
* Inspired By
1111
* Ratchet Websocket Library: helper file
1212
* @author Romain GALLIEN <[email protected]>
1313
*/
14+
15+
defined('BASEPATH') or exit('No direct script access allowed');
16+
1417
if (!function_exists('valid_json')) {
1518

16-
/**
17-
* Check JSON validity
18-
* @method valid_json
19-
* @author Romain GALLIEN <[email protected]>
20-
* @param mixed $var Variable to check
21-
* @return bool
22-
*/
23-
function valid_json($var)
24-
{
25-
return (is_string($var)) && (is_array(json_decode($var,
26-
true))) && (json_last_error() == JSON_ERROR_NONE) ? true : false;
27-
}
19+
/**
20+
* Check JSON validity
21+
* @method valid_json
22+
* @param mixed $var Variable to check
23+
* @return bool
24+
*/
25+
function valid_json($var)
26+
{
27+
return (is_string($var)) && (is_array(json_decode($var,
28+
true))) && (json_last_error() == JSON_ERROR_NONE) ? true : false;
29+
}
2830
}
2931

3032
if (!function_exists('valid_jwt')) {
3133

32-
/**
33-
* Check JWT validity
34-
* @method valid_jwt
35-
* @param mixed $token Variable to check
36-
* @return Object/false
37-
*/
38-
function valid_jwt($token)
39-
{
40-
return AUTHORIZATION::validateToken($token);
41-
}
34+
/**
35+
* Check JWT validity
36+
* @method valid_jwt
37+
* @param mixed $token Variable to check
38+
* @return Object/false
39+
*/
40+
function valid_jwt($token)
41+
{
42+
return AUTHORIZATION::validateToken($token);
43+
}
4244
}
4345

4446
/**
45-
* Ratchet Websocket Library: helper file
46-
* @author Romain GALLIEN <[email protected]>
47+
* Codeigniter Websocket Library: helper file
4748
*/
4849
if (!function_exists('output')) {
4950

50-
/**
51-
* Output valid or invalid logs
52-
* @method output
53-
* @author Romain GALLIEN <[email protected]>
54-
* @param string $type Log type
55-
* @param string $var String
56-
* @return string
57-
*/
58-
function output($type = 'success', $output = null)
59-
{
60-
if ($type == 'success') {
61-
echo "\033[32m" . $output . "\033[0m" . PHP_EOL;
62-
} elseif ($type == 'error') {
63-
echo "\033[31m" . $output . "\033[0m" . PHP_EOL;
64-
} elseif ($type == 'fatal') {
65-
echo "\033[31m" . $output . "\033[0m" . PHP_EOL;
66-
exit(EXIT_ERROR);
67-
} else {
68-
echo $output . PHP_EOL;
69-
}
70-
}
51+
/**
52+
* Output valid or invalid logs
53+
* @method output
54+
* @param string $type Log type
55+
* @param string $var String
56+
* @return string
57+
*/
58+
function output($type = 'success', $output = null)
59+
{
60+
if ($type == 'success') {
61+
echo "\033[32m" . $output . "\033[0m" . PHP_EOL;
62+
} elseif ($type == 'error') {
63+
echo "\033[31m" . $output . "\033[0m" . PHP_EOL;
64+
} elseif ($type == 'fatal') {
65+
echo "\033[31m" . $output . "\033[0m" . PHP_EOL;
66+
exit(EXIT_ERROR);
67+
} else {
68+
echo $output . PHP_EOL;
69+
}
70+
}
7171
}

0 commit comments

Comments
 (0)