PHP Classes

File: colis.php

Recommend this page to a friend!
  Classes of Ahmad Mustapha   ReactPHP Chat Client   colis.php   Download  
File: colis.php
Role: Example script
Content type: text/plain
Description: Example script
Class: ReactPHP Chat Client
Implement a live chat system based on Web Sockets
Author: By
Last change:
Date: 3 years ago
Size: 1,065 bytes
 

Contents

Class file image Download
<?php
use App\Core\Colis\Colis;

Colis::prefix('system.')
    ->
group(function($colis){
       
$colis->listen('ping', 'SystemListener@ping');
       
$colis->listen('pong', 'SystemListener@pong');
    });


Colis::listen('hail.reactphp', 'MainListener@hello');

Colis::prefix('chat.')
    ->
namespace('Chat')
    ->
group(function($colis){
       
//Public Messaging
       
$colis->prefix('public.')
            ->
namespace('PublicChat')
            ->
group(function($colis){
               
$colis->listen('join', 'ChatListener@join');
               
$colis->listen('leave', 'ChatListener@leave');
               
$colis->listen('send', 'ChatListener@send');
               
$colis->listen('receive', 'ChatListener@receive');
            });
           
       
//Private Messaging
       
$colis->prefix('private.')
            ->
namespace('Private\\')
            ->
group(function($colis){
               
$colis->listen('send', 'ChatListener@send');
               
$colis->listen('receive', 'ChatListener@receive');
            });
           
    });