Giter Site home page Giter Site logo

server's Introduction

服务器模块

在很多时候,php在项目中都不能单独存在。对于web项目,大部分情况需要搭配nginx/apache等web服务器。

传统的PHP开发方式,在一些特定场景下,会显得很力不从心,如:

  1. 长链接服务
  2. 需要持久化对象或请求的服务

幸好现在有swooleworkerman这类服务端框架存在。

本人相对来说比较熟悉workerman,所以在平时使用时,会偏向选择workerman。

那既然有了workerman,为什么还要写这个模块呢?在我看来,workerman虽然很好,但是还不能做到开箱即用,而且一些使用方法上,个人也很不习惯。

所以我希望在workerman之上再封装一层,在整合了workerman强大功能的同时,为用户提供更高的便捷性。

安装

首先需要下载和安装composer,具体请查看官网的Download页面

在你的composer.json中增加:

"require": {
    "tourze/server": "^1.0"
},

或直接执行

composer require tourze/server:"^1.0"

建议在main.php配置文件中加入:

    'component' => [
        'http' => [
            'class' => 'tourze\Server\Component\Http',
            'params' => [
            ],
            'call' => [
            ],
        ],
        'session' => [
            'class' => 'tourze\Server\Component\Session',
            'params' => [
            ],
            'call' => [
            ],
        ],
        'log' => [
            'class' => 'tourze\Server\Component\Log',
            'params' => [
            ],
            'call' => [
            ],
        ],
    ],

以保证输出的header正确。

使用

复制start.phpconfig/main.php到你的项目目, 并按照说明配置好config/main.php中的server节.

server's People

Contributors

tourze avatar

Watchers

 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.