Giter Club home page Giter Club logo

swoyii's Introduction

项目简介

本项目是基于 Yii2、Swoole 搭建的 API 服务脚手架,内置请求、响应、日志、异常、JWT 组件便于团体基于此项目快速开发。
本项目适应人群:有 Yii2 开发经验、了解并有 Swoole 使用经验。

环境依赖

  • PHP >= 7.1
  • Swoole >= 4.4.16

目录结构

├── bin/                   ----- 程序入口目录
│   ├── server.pid
│   └── swoyii
│   └── yii
├── command/               ----- 命令行代码目录
├── common/                ----- 具有独立功能的 class bean
├── component/             ----- 组件代码目录
├── config/                ----- 应用配置目录
│   ├── dev
│   └── local
├── exception/             ----- 异常类目录
├── helper/                ----- 助手函数目录
├── log/                   ----- 日志文件存放目录
├── middleware/            ----- 中间件代码目录
├── models/                ----- 数据模型目录
├── repositories/          ----- 数据操作文件目录
├── module/                ----- 功能模块目录
├── params/                ----- 公共参数目录
├── resource/              ----- 资源目录
    ├── template/
│   └── language/
├── routes/                ----- 路由文件目录
├── rule/                  ----- 规则文件目录
├── runtime/               ----- 临时文件目录
├── server/                ----- 服务文件目录
├── test/                  ----- 单元测试目录
└── composer.json

快速启动

  • 安装依赖
$> composer install
  • 设置环境变量
$> export RUNTIME_ENV=dev
  • 启动服务器
$> ./bin/swoyii start
  • 如果一切顺利,运行到最后你将看到如下的输出:
                             .__.__ 
  ________  _  ______ ___.__.|__|__|
 /  ___/\ \/ \/ /  _ <   |  ||  |  |
 \___ \  \     (  <_> )___  ||  |  |
/____  >  \/\_/ \____// ____||__|__|
     \/               \/
Server         Name:      swoyii
System         Name:      Darwin
PHP            Version:   7.2.12
Swoole         Version:   4.4.16
Framework      Version:   2.0.32
Listen         Addr:      0.0.0.0
Listen         Port:      9203
[info] 2020-02-28 15:07:53 Http Server Start, Pid is 88624
[info] 2020-02-28 15:07:53 Task Worker #1 Start 
[info] 2020-02-28 15:07:53 Worker #0 Start 

生成 Model && Repository

$> ./bin/yii gii/model --tableName={tableName} --modelClass={className} # 生成Model文件
$> ./bin/yii gii/repository --modelName={className} # 生成Repo文件

swoyii's People

Contributors

vincentye123 avatar

Watchers

Klaus avatar  avatar  avatar  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.