Giter Club home page Giter Club logo

jkdyaf's Introduction

JKDYAF - V2.0.0

基于 YAF + SWOOLE APi框架

       ____ __ ______  _____    ______
      / / //_// __ \ \/ /   |  / ____/
 __  / / ,<  / / / /\  / /| | / /_
/ /_/ / /| |/ /_/ / / / ___ |/ __/
\____/_/ |_/_____/ /_/_/  |_/_/

介绍

简单、直接、非传统

JkdYaf 一个简单、高性能常驻内存的PHP框架。

基于Yaf与Swoole开发,性能较传统基于 PHP-FPM 的框架有质的提升。

一款专为Api开发的轻量级框架。一款面向中小型企业级项目的高可用、低门槛PHP开源框架。

详细文档

特性

  • HTTP 服务
  • Redis连接池
  • Jwt 认证
  • 协程化
  • 定时任务
  • 日志管理
  • 路由管理
  • Yac无锁共享内存

服务器要求

  • php 7.x 或更高版本
  • yaf 3.3.x 或更高版本
  • swoole 5.4.x 或更高版本
  • mysql
  • redis
  • yac

安装JkdYaf

git clone https://github.com/crytjy/JkdYaf.git

php.ini配置

extension=yaf.so
[yaf]   
yaf.environ=product
yaf.cache_config=1
yaf.use_namespace=1
yaf.library="/path/JkdYafLibrary/"  //全局类库的目录路径
    
extension=yac.so
[yac]
;是否开启yac,1表示开启, 0表示关闭
yac.enable=1 
;4M可以得到32768个key, 32M可以得到262144个key
yac.keys_memory_size=4M
;申请的最大value内存
yac.values_memory_size = 64M 
;是否压缩数据ss
yac.compress_threshold = '-1' 
;关闭在cli下使用yac
yac.enable_cli = 1

修改后需要重启php service php-fpm restart

app.ini配置

项目conf/app.ini

[common]
application.directory = APP_PATH "/app"
application.dispatcher.catchException = TRUE
application.dispatcher.throwException = TRUE
;本地类库
application.library = APP_PATH "/library"
application.library.namespace = "Com"
;多模块(多个模块)
application.modules = "Api"
;域名
siteUrl = "http://localhost/"
;公共类库路径 (该路径必须和php.ini配置里填写的一致)
comLibsPath = "/www/wwwroot/yaf/yafLibrary/"

#数据库配置
[db]
db.host = "localhost"
db.port = 3306
db.dbname = "dbname"
db.username = "username"
db.password = "password~"
db.charset = "utf8mb4"

#日志配置
[log]
;日志保留天数
log.day = 7
;日志路径
log.path = APP_PATH "/runtime/log/"

[product : common : db : log]

jkdYaf.ini配置

项目conf/jkdYaf.ini

; JKDYAF 配置
[common]
ip = "0.0.0.0"
port = 12222    //监听端口,随意改
app_name = JkdYaf   //项目名称(英文),多个项目时区分
master_process_name = JkdYaf-Master
manager_process_name = JkdYaf-Manager
event_worker_process_name = JkdYaf-Worker-%s
event_tasker_process_name = JkdYaf-Tasker-%s

; 记录master和manager的进程id
pid_file = APP_PATH "/runtime/master.pid"
; 记录worker的进程id
worker_pid_file = APP_PATH "/runtime/worker.pid"
; 记录tasker的进程id
tasker_pid_file = APP_PATH "/runtime/tasker.pid"
; 记录timer的进程id
timer_pid_file = APP_PATH "/runtime/timer.pid"

; 以下参数根据服务器配置相应改动
[server]
process_num = 1
worker_num = 4
max_request = 30000
dispatch_mode = 3
log_file = APP_PATH "/runtime/swoole.log"
log_rotation = SWOOLE_LOG_ROTATION_DAILY

[product : common : server]

启动

配置好后,进入项目根目录,启动项目

cd /yaf/
php bin/JkdYaf.php start 
php bin/JkdYaf.php start -d  //守护进程

浏览器访问 http://localhost:12222/api/index

{"code":1,"message":"success","data":"Hello JkdYaf !"}

jkdyaf's People

Contributors

crytjy 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.