定制 tomchanio/php_cent 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tomchanio/php_cent

Composer 安装命令:

composer require tomchanio/php_cent

包简介

Centrifugo (Centrifuge) [2.0+] PHP Server REDIS & HTTP API implementation for Laravel 5.5+

README 文档

README

Centrifugo (Centrifuge) [2.0+] PHP Server HTTP API implementation for Laravel 5.5+

Base Installation

  1. Run composer require tomchanio/laravel_cent & composer update
  2. Create config/centrifugo.php as provided below
  3. Add alias in config/app.php as provided below

Config example config/centrifugo.php

<?php
    return [
        'url'         => 'http://localhost:8000/api/', // full api url
        'secret'          => 'skoniksnyashamoyanikamuneotdam', // you super secret key
        'apikey'          => 'skoniksnyashamoyanikamuneotdam', // you api key
    ];

Alias additions config/app.php

    'aliases' => [
        ...
        'Centrifugo'=> Tomchanio\Centrifugo\Centrifugo::class,
    ]
    

[Module usage || sending your requests] example

<?php
use Centrifugo;

class Controller
{
    public function your_func()
    {
        // declare Centrifugo
        $Centrifugo = new Centrifugo();

        // generating token example
        $userid = '1337_1448_228';
        $info = ['token' => '123'];
        $token = $Centrifugo->generateToken($userid, $info);
        // publishing example
        $Centrifugo->publish("channel" , ["yout text or even what rou want"]);
        
        // each method returns its response; 
        // list of awailible methods: 
        $response = $Centrifugo->publish($channle, $messageData);
        $response = $Centrifugo->broadcast($channles, $messageData);
        $response = $Centrifugo->unsubscribe($channle, $userId);
        $response = $Centrifugo->disconnect($userId);
        $response = $Centrifugo->presence($channle);
        $response = $Centrifugo->presence_stats($channle);
        $response = $Centrifugo->history($channle);
        $response = $Centrifugo->history_remove($channle);
        $response = $Centrifugo->channels();
        $response = $Centrifugo->info();
        $response = $Centrifugo->generateToken($user);
        
        // You can create a controller to bild your own interface;
    }

For more information go here

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固