PHP code example of brainboxlabs / brain-socket

1. Go to this page and download the library: Download brainboxlabs/brain-socket library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

brainboxlabs / brain-socket example snippets


'providers' => array(
	...
	'BrainSocket\BrainSocketServiceProvider',

'aliases' => array(
	...
	'BrainSocket'     => 'BrainSocket\BrainSocketFacade',

Available commands:
brainsocket
	brainsocket:start

php artisan brainsocket:start

php artisan brainsocket:start --port=8081


Event::listen('generic.event',function($client_data){
	return BrainSocket::message('generic.event',array('message'=>'A message from a generic event fired in Laravel!'));
});

Event::listen('app.success',function($client_data){
	return BrainSocket::success(array('There was a Laravel App Success Event!'));
});

Event::listen('app.error',function($client_data){
	return BrainSocket::error(array('There was a Laravel App Error!'));
});