2017 © Pedro Peláez
 

library http-server

workerman http api

image

eaglexpf/http-server

workerman http api

  • Thursday, July 19, 2018
  • by eaglexpf
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 200 % Grown

The README.md

HttpServer

roc.xu

composer require eaglexpf/http-server @dev

start.php 启动文件


require_once __DIR__.'/vendor/autoload.php'; $http = new \HttpServer\HttpServer("http://0.0.0.0:21001"); //进程名字 $http->name = 'HttpServer'; //进程数量 $http->count = 4; //配置文件地址 $http->config_file = __DIR__.'/config.php'; \Workerman\Worker::runAll();

config.php配置文件

return [
    'domain' => [
        'localhost' => [                            //域名
            'root' => __DIR__,                      //start.php启动文件的目录的绝对路径
            'controller' => '/backend/controllers', //项目文件根目录
            'statics' => '/backend/web',            //静态资源根目录
        ]
    ],

    'db' => [
        'HttpServer' => [
            'host'  =>  '127.0.0.1',
            'port'  =>  3306,
            'user'  =>  'root',
            'password'  =>  '123456',
            'dbname'    =>  'HttpServer',
            'charset'   =>  'utf8mb4',
        ],
    ],

    'redis' => [
        'HttpServer' => [
            'host' => '127.0.0.1',
            'port' => '6379',
            'password' => '123456',
            'db' => 1
        ]
    ]
];

controllers示例

namespace backend\controllers;
use HttpServer\Controllers;

class Index extends Controllers
{
    public function index(){
        $this->send('Hello Roc');
    }
    public function hello(){
        $this->sendJson(['msg'=>'Hello World!!!']);
    }

}

The Versions

19/07 2018

dev-master

9999999-dev

workerman http api

  Sources   Download

GPL-3.0+

by roc.xu