-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
139 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
/** | ||
* 应用的配置信息 | ||
* 通过config('app.xx')获取 | ||
*/ | ||
return [ | ||
// 系统时区 | ||
'timezone' => 'Asia/Shanghai', | ||
// 启用调试模式 | ||
'debug' => true, | ||
|
||
//===========其他配置=========== | ||
|
||
// 应用名 -保证唯一性,避免在同一机器上运行相同的应用 | ||
'app_name' => 'sword', | ||
|
||
// 服务器域名 | ||
'host' => 'youhost.cn', | ||
// 资源服务器域名 | ||
'res_host' => 'res.youhost.cn' | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
/** | ||
* 数据库连接配置 | ||
* 通过config('database.xx')获取 | ||
*/ | ||
return [ | ||
'host' => '127.0.0.1', //服务器地址 | ||
'port' => 3306, //端口 | ||
'user' => 'user', //用户名 | ||
'password' => 'pass', //密码 | ||
'charset' => 'utf8', //编码 | ||
'name' => 'dbname', //数据库名 | ||
|
||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/** | ||
* redis连接配置 | ||
*/ | ||
return [ | ||
'host' => '127.0.0.1', //服务器地址 | ||
'port' => 6379, //端口 | ||
'password' => '', //密码 | ||
'db' => 0 //默认数据库 0-12 | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,32 @@ | ||
<?php | ||
/** | ||
* EasySwoole框架配置信息 | ||
* | ||
*/ | ||
return [ | ||
'SERVER_NAME' => "EasySwoole", | ||
'MAIN_SERVER' => [ | ||
'LISTEN_ADDRESS' => '0.0.0.0', | ||
'PORT' => 8105, | ||
'SERVER_TYPE' => EASYSWOOLE_WEB_SOCKET_SERVER, //可选为 EASYSWOOLE_SERVER EASYSWOOLE_WEB_SERVER EASYSWOOLE_WEB_SOCKET_SERVER,EASYSWOOLE_REDIS_SERVER | ||
'PORT' => 8100, | ||
'SERVER_TYPE' => EASYSWOOLE_WEB_SERVER, //可选为 EASYSWOOLE_SERVER EASYSWOOLE_WEB_SERVER EASYSWOOLE_WEB_SOCKET_SERVER,EASYSWOOLE_REDIS_SERVER | ||
'SOCK_TYPE' => SWOOLE_TCP, | ||
'RUN_MODEL' => SWOOLE_PROCESS, | ||
|
||
// Swoole配置信息 | ||
'SETTING' => [ | ||
'worker_num' => 8, | ||
'reload_async' => true, | ||
'max_wait_time'=> 3, | ||
|
||
//兼容文件上传最大值 | ||
'package_max_length' => 20 * 1024 * 1024 | ||
// 兼容文件上传最大值 | ||
// 'package_max_length' => 20 * 1024 * 1024 | ||
], | ||
'TASK' => [ | ||
'workerNum' => 4, | ||
'maxRunningNum' => 128, | ||
'timeout' => 15 | ||
] | ||
], | ||
'TEMP_DIR' => null, | ||
'TEMP_DIR' => './Temp', | ||
'LOG_DIR' => './Temp/Log' | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,41 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
/** | ||
* Easyswoole命令行 | ||
* 启动服务:./sword server start | ||
* 常驻内存:./sword server start -d | ||
* 停止服务:./sword server stop | ||
*/ | ||
require_once "./vendor/bin/easyswoole"; | ||
|
||
use EasySwoole\EasySwoole\Command\CommandRunner; | ||
use EasySwoole\Command\Caller; | ||
|
||
$file = __DIR__ . '/vendor/autoload.php'; | ||
|
||
if (file_exists($file)) { | ||
require $file; | ||
}else{ | ||
die("include composer autoload.php fail\n Please run: composer install\n"); | ||
} | ||
|
||
$realCwd = substr(realpath($file),0,-strlen("/vendor/autoload.php")); | ||
|
||
defined('IN_PHAR') or define('IN_PHAR', boolval(\Phar::running(false))); | ||
defined('RUNNING_ROOT') or define('RUNNING_ROOT', $realCwd); | ||
defined('EASYSWOOLE_ROOT') or define('EASYSWOOLE_ROOT', IN_PHAR ? \Phar::running() : $realCwd); | ||
|
||
if(file_exists(EASYSWOOLE_ROOT.'/bootstrap.php')){ | ||
require_once EASYSWOOLE_ROOT.'/bootstrap.php'; | ||
} | ||
|
||
$caller = new Caller(); | ||
$caller->setScript(current($argv)); | ||
$caller->setCommand(next($argv)); | ||
$caller->setParams($argv); | ||
reset($argv); | ||
|
||
$ret = CommandRunner::getInstance()->run($caller); | ||
if($ret && !empty($ret->getMsg())){ | ||
echo $ret->getMsg()."\n"; | ||
} | ||
|