Giter VIP home page Giter VIP logo

gsf's Introduction

GSF unstable v0.1

Build By usher.yue
基于Swoole框架的封装扩展和完善,Swoole由于其文档太少,难度对于PHP程序员来说过于大,很多php程序员敬而远之。
GSF框架就是为了让PHP程序员更简单的使用Swoole来开发自己的应用程序。

入口文件代码

//屏蔽警告
error_reporting(E_ERROR);  
use Swoole\Network\Server;  
use Swoole\Log\EchoLog;  
use Swoole\Config;
use Swoole\Protocol\WebServer;
define('DEAMON',false);
//MVC define 加载MVC扩展插件
define('MVCAPP',true) ;
//定义web路径
define('WEBPATH', realpath(__DIR__ ));
//config file 自定义
define('CONFIGFILE',WEBPATH.'/config/http_config.ini');
//Server Log File
define('LOGFILE',WEBPATH . '/logs/server.log');
//定义APPPATH
define('APPPATH',WEBPATH . '/apps/');
//包含配置文件
require WEBPATH . '/libs/lib_config.php';
//关闭debug
Config::$debug = false;
//设置PID文件的存储路径
Server::setPidFile(__DIR__ . '/logs/http_server.pid');

/**
 * 启动app server  独立于nginx apache
 * php http_server.php start|stop|reload   //配置默认路由
 */
Server::start(function()
{
  $server = WebServer::create(CONFIGFILE);
   //设置app的configs
  $server->setAppPath(APPPATH);
  $server->setLogger(new EchoLog(LOGFILE));
 //作为守护进程  生产环境开启 设置DEAMON=true
 if(DEAMON){
     $server->daemonize();
 }
//启动任务
//$Task=Task::StartHomeworkCompletionCalcTask();
//kill task
//$Task->kill();
//启动服务
$server->run(array('worker_num' =>1, 'react_num'=>2, 'max_request' => 500000, 'log_file' => LOGFILE));
});

gsf's People

Contributors

usheryue avatar

Watchers

James Cloos avatar wangmingyang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.