CodeIgniter WebSocket library. It allows you to make powerfull realtime applications by using Ratchet (Socketo.me & ratchet_client) Websocket technology.
If you Face any problem you may check CodeIgniter WebSocket Example https://github.com/takielias/codeigniter-websocket-example
Just by running following command in the folder of your project :
composer require takielias/codeigniter-websocket
Don't forget to include your autoload to CI config file :
$config['composer_autoload'] = FCPATH.'vendor/autoload.php';
If you want Single command installation just Execute the Command in the Project directory
N.B: It will make 2 new controllers Welcome.php and User.php
php vendor/takielias/codeigniter-websocket/install.php --app_path=application
Here app_path defines your default Codeigniter Application directory Name
WOW You made it !!!
Open two pages of your project on following url with different IDs :
http://localhost/your project directory/index.php/user/index/1
http://localhost/your project directory/index.php/user/index/2
If you have something like that, everything is ok for you:
You can try typing and sending something in each page (see cmd for more logs).
If you want to enable debug mode type the command bellow in you'r project folder :
php index.php welcome index
If you see the message the message bellow, you are done (don't close your cmd) !
If you want to broadcast message with php script or something else you can use library like textalk/websocket (who is included in my composer.json as required library)
Note : The first message is mandatory and always here to perform authentication
$client = new Client('ws://0.0.0.0:8282');
$client->send(json_encode(array('user_id' => 1, 'message' => null)));
$client->send(json_encode(array('user_id' => 1, 'message' => 'Super cool message to myself!')));
The library allow you to define some callbacks, here's an example :
class Welcome extends CI_Controller
{
public function index()
{
// Load package path
$this->load->add_package_path(FCPATH . 'vendor/takielias/codeigniter-websocket');
$this->load->library('Codeigniter_websocket');
$this->load->remove_package_path(FCPATH . 'vendor/takielias/codeigniter-websocket');
// Run server
$this->codeigniter_websocket->set_callback('auth', array($this, '_auth'));
$this->codeigniter_websocket->set_callback('event', array($this, '_event'));
$this->codeigniter_websocket->run();
}
public function _auth($datas = null)
{
// Here you can verify everything you want to perform user login.
// However, method must return integer (client ID) if auth succedeed and false if not.
return (!empty($datas->user_id)) ? $datas->user_id : false;
}
public function _event($datas = null)
{
// Here you can do everyting you want, each time message is received
echo 'Hey ! I\'m an EVENT callback'.PHP_EOL;
}
}
Be free to open an issue or send pull request
Hey dude! Help me out for a couple of
die('This file is used for development purposes only.'); /** * PhpStorm Code Completion to CodeIgniter + HMVC * * @package CodeIgniter * @subpackage PhpStorm * @category Code Completion * @version 3.1
安装CodeIgniter非常容易。 只需按照以下步骤操作 - Step-1 - 从CodeIgniter链接下载CodeIgniter 遗产和最新版本有两种不同的选择。 名称本身是自我描述性的。 旧版本的版本低于2.x,最新版本为3.0版本。 我们也可以使用GitHub并获取所有最新的脚本.. Step-2 - 解压缩文件夹。 Step-3 - 将所有文件和文件夹上传到您的服务器。 Step-4
CodeIgniter 是一个简单快速的PHP MVC 框架。EllisLab 的工作人员发布了 CodeIgniter。许多企业尝试体验过所有 PHP MVC 框架之后,CodeIgniter 都成为赢家,主要是由于它为组织提供了足够的自由支持,允许开发人员更迅速地工作。 自由意味着使用 CodeIgniter 时,您不必以某种方式命名数据库表,也不必根据表命名模型。这使 CodeIgniter
CodeIgniter-Ratchet-Websocket NOTICE : This project is NOT production ready. This library contains the demo of commenting/posting realtime using CodeIgniter-Ratchet-Websocket with AngularJS as client-
默认情况下,CodeIgniter 中的 URL 被设计成对搜索引擎和人类友好。 不同于使用标准的 “查询字符串” 方法,CodeIgniter 使用基于段的方法: example.com/news/article/my_article 注解 在 CodeIgniter 中也可以使用查询字符串的方法,参见下文。 URI 分段 如果遵循模型-视图-控制器模式,那么 URI 中的每一段通常表示下面的
CodeIgniter Permission 是专为 CodeIgniter 4 打造的权限控制库,基于 PHP-Casbin,支持 ACL、RBAC、ABAC 多种模型。 它采用了元模型的设计思想,支持多种经典的访问控制方案,如基于角色的访问控制 RBAC、基于属性的访问控制 ABAC 等。
问题内容: 我正在使用Codeigniter交易 这很好用,我的问题是在和我正在调用其他函数,而这些函数处理数据库,因此它们包含插入和更新以及一些删除…例如: 现在,如果执行了这些功能并且发生了一些错误,CodeIgniter将不会回滚。 处理此类问题的最佳方法是什么? 我想到的唯一解决方案是从这些函数中返回错误,并在这些函数中添加(和),如果返回错误,则执行 例如: 有更好的方法吗? 更新1: