forked from stanislav-web/ZF2-PHP-WebSocket-Server-Factory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule.php
98 lines (89 loc) · 2.77 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
namespace WebSockets; // declare namespace for the current module "WebSockets"
use Zend\ModuleManager\Feature\AutoloaderProviderInterface, // provide autoloader configurations
Zend\ModuleManager\Feature\ViewHelperProviderInterface, // provide view helpers
Zend\ModuleManager\Feature\ConfigProviderInterface, // interfaces for configurator
Zend\ModuleManager\Feature\ConsoleUsageProviderInterface, // interfaces for CLI
Zend\Console\Adapter\AdapterInterface as Console, // add adapter for provider
Zend\Console\Charset\CharsetInterface;
/**
* Module for the console launch permanent connection WebSockets
* @package Zend Framework 2
* @subpackage WebSockets
* @since PHP >=5.4
* @version 1.0
* @author Stanislav WEB | Lugansk <[email protected]>
* @copyright Stanilav WEB
* @license Zend Framework GUI licene
* @filesource /vendor/WebSockets/Module.php
*/
class Module implements
AutoloaderProviderInterface,
ViewHelperProviderInterface,
ConfigProviderInterface,
ConsoleUsageProviderInterface,
CharsetInterface
{
/**
* getConfig() configurator boot method for application
*
* @return array
*/
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
/**
* getAutoloaderConfig() installation method autoloaders
* * In my case, I connect the class map
* * And set the namespace for the MVC application directory
*
* @return array
*/
public function getAutoloaderConfig()
{
return [
// add classmap file. Be careful! Update this map when adding a new provider!
'Zend\Loader\ClassMapAutoloader' => [
__DIR__ . '/autoload_classmap.php',
],
];
}
/**
* getViewHelperConfig() Setup your view helpers
*
* @return array
*/
public function getViewHelperConfig()
{
return [
'invokables' => [
'socket' => '\\View\Helper\Socket',
],
];
}
/**
* getServiceConfig() method of loading services
*
* @return array
*/
public function getServiceConfig()
{
return [];
}
/**
* getConsoleUsage(Console $console) cantilever load scripts, descriptions of commands (For Console usage help)
*
* @return array
*/
public function getConsoleUsage(Console $console)
{
return [
// Here I describe the console Command
'websocket open <app>' => 'Server start',
'websocket system <option>' => 'type the system command',
['app' => 'application will be run throught socket'],
['option' => 'system command for your CLI'],
];
}
}