此包已被废弃,不再维护。作者建议使用 huang-yi/shadowfax 包代替。

Swoole Http 服务器。

dev-master 2019-09-12 03:01 UTC

This package is auto-updated.

Last update: 2020-03-05 16:52:43 UTC


README

此包提供 HTTP 服务器工厂。

使用方法

将此包要求到您的 Laravel 或 Lumen 项目中

$ composer require shadowfax-php/http

创建一个 server.php 文件

<?php

require __DIR__.'/vendor/autoload.php';

use Illuminate\Events\Dispatcher;
use ShadowfaxPHP\Http\HttpServerFactory;

$server = (new HttpServerFactory(new Dispatcher))
    ->setHost('127.0.0.1')
    ->setPort(1215)
    ->setOptions([
        'enable_static_handler' => true,
        'document_root' => public_path(),
    ])
    ->setAppBootstrapper(base_path('/bootstrap/app.php'))
    ->createServer();

$server->start();

启动 http 服务器

$ php server.php