All Projects → showx → phpshow

showx / phpshow

Licence: Apache-2.0 license
phpshow,简单易用的php框架

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to phpshow

Hookphp
HookPHP基于C扩展搭建内置AI编程的架构系统-支持微服务部署|热插拔业务组件-集成业务模型|权限模型|UI组件库|多模板|多平台|多域名|多终端|多语言-含常驻内存|前后分离|API平台|LUA QQ群:679116380
Stars: ✭ 575 (+4007.14%)
Mutual labels:  codeigniter, swoole, thinkphp
ezswoole
fashop framework
Stars: ✭ 14 (+0%)
Mutual labels:  swoole, thinkphp
Identity Card
A simple proof of identity card of the people's Republic of China.
Stars: ✭ 154 (+1000%)
Mutual labels:  codeigniter, thinkphp
socialigniter
This is core install of social igniter application. Please follow the Readme below
Stars: ✭ 78 (+457.14%)
Mutual labels:  codeigniter
CodeIgniter-3.0.0-ORM-Twig
First CodeIgniter 3 using orm and template engine twig
Stars: ✭ 19 (+35.71%)
Mutual labels:  codeigniter
OpenTor-X
Open Source Torrent Index Website
Stars: ✭ 19 (+35.71%)
Mutual labels:  codeigniter
SIAKAD-PT
Sistem Informasi Akademik Perguruan Tinggi with Framework CodeIgniter
Stars: ✭ 53 (+278.57%)
Mutual labels:  codeigniter
jwt-auth
JSON Web Token Authentication for Thinkphp
Stars: ✭ 113 (+707.14%)
Mutual labels:  thinkphp
swoft-project
基于Swoft的项目结构
Stars: ✭ 17 (+21.43%)
Mutual labels:  swoole
manage
基于vue-cli与thinkphp的简单登录注册系统
Stars: ✭ 71 (+407.14%)
Mutual labels:  thinkphp
laravel-binlog
Add mysql binlog event listening for Laravel ( 为Laravel框架添加Mysql Binlog事件监听 )
Stars: ✭ 19 (+35.71%)
Mutual labels:  swoole
yafcms
基于yaf+swoole的高效率,快如闪电的博客cms系统!
Stars: ✭ 17 (+21.43%)
Mutual labels:  swoole
Slice-Library
Slice-Library is a CodeIgniter library that simulates Laravel's Blade templating system!
Stars: ✭ 60 (+328.57%)
Mutual labels:  codeigniter
sdebug
Xdebug — Step Debugger and Debugging Aid for PHP
Stars: ✭ 263 (+1778.57%)
Mutual labels:  swoole
codeigniter-rest
CodeIgniter 3 RESTful API Resource Base Controller
Stars: ✭ 71 (+407.14%)
Mutual labels:  codeigniter
thrift2-hbase
thrift2-hbase component for Hyperf.
Stars: ✭ 14 (+0%)
Mutual labels:  swoole
rimbun
Codeigniter Starter
Stars: ✭ 25 (+78.57%)
Mutual labels:  codeigniter
CIgniter-Datatables
CodeIgniter library for Datatables server-side processing / AJAX, easy to use :3
Stars: ✭ 39 (+178.57%)
Mutual labels:  codeigniter
slim-swoole
Slim 3 MVC Skeleton With Swoole
Stars: ✭ 52 (+271.43%)
Mutual labels:  swoole
swoole-demo
This is a simple swoole usage demo
Stars: ✭ 26 (+85.71%)
Mutual labels:  swoole
      _               _
 _ __ | |__  _ __  ___| |__   _____      __
| '_ \| '_ \| '_ \/ __| '_ \ / _ \ \ /\ / /
| |_) | | | | |_) \__ \ | | | (_) \ V  V /
| .__/|_| |_| .__/|___/_| |_|\___/ \_/\_/
|_|         |_|

phpshow

phpshow,轻量简单易用的高性能php框架,默认启动workerman模式,抗大并发能力。

服务器环境

  1. Nginx
  2. php7以上

相关扩展

  1. pcntl
  2. libevent
  3. seaslog(选用)
  4. swoole(选用)

安装

统一使用phpcomposer安装 composer require showx/phpshow

协议

phpshow 的开源协议为 Apache-2.0,详情参见LICENSE

php配置

项目config/site.php配置

详见参考事例

return [
    //框架里的模式 [0普通启动|1 workerman模式];
    'type' => 1,
    // 绑定的地址
    'host' => '0.0.0.0',
	// 启动的端口
    'port' => 8080,
	//进程worker数量
    'count' => 4,
    //数据库池的数量
    'mysql_pool_num' => 6,
    //调试模式
    'debug' => 1,
    //开发模式 [dev 查看加载异常|dev2 查看接口使用内存等]
    'dev' => 1,
    'dev2' => 0,
];

php.ini

建议短标记

  1. short_open_tag = On ;php短标记打开 ,模板要使用这样的标记

nginx配置

nginx正常模式

server{
    ...
	location / {
		if ( !-e $request_filename) {
			rewrite ^(.*)$ /index.php?s=/$1 last;
			break;
		}
		try_files $uri $uri/ /index.html;
	}
	location ~ [^/]\.php(/|$) {
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		include fastcgi_params;
		fastcgi_split_path_info       ^(.+\.php)(.*)$;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_param PATH_INFO       $fastcgi_path_info;
	}
	...
}

高性能workerman模式

server {
	server_name xxx.com
	location / {
		proxy_pass http://172.20.0.3:8080;
	    proxy_http_version 1.1;
	    proxy_set_header X-Real-IP $remote_addr;
	}
}

框架教程

composer之后 ./vender/showx/phpshow/app 项目示例 ./vender/showx/phpshow/src 核心代码文件

简单的mvc模式 主要逻辑在于/app文件夹中 入口在/public文件夹(详情查询./vender/showx/phpshow/app)

路由

路由采用简单的定义方式 $url/{$ct}/{$ac},http://www.baidu.com/index/index,默认ct和ac为index. 支持path_info /index.php/index/index

配置文件

配置文件主要饮食site(基础配置)database(数据库配置)route_rule(路由规则配置) 放在app项目下的config文件夹

app项目

├── config 配置目录
│   ├── cron.php
│   ├── db.php
│   ├── signkey.php
│   └── site.php
├── control 控制类
│   ├── IndexController.php
├── index.php   程序入口
├── model 模型类
│   ├── IndexModel.php
├── public 静态文件目录
│   ├── favicon.ico
│   ├── index.html
│   ├── index.php   普通模式下的入口
│   └── robots.txt
├── runtime  临时缓存与日志目录
│   └── Log
└── view  模板目录
    ├── footer.php
    ├── header.php
    ├── index.php

新建composer.json文件

	autoload": {
        "psr-4": {
            "app\\": "app/"
        }
    },

增加本地项目的autoload composer require showx/phpshow 在app里使用php index.php start启动服务器

核心类的介绍

  1. \phpshow\request 获取数据类
  2. \phpshow\response 输出类
  3. \phpshow\loader 核心加载类
  4. \phpshow\control 基层控制器
  5. \phpshow\model 基层模型

工具库

  1. \phpshow\lib\redis redis类
  2. \phpshow\lib\http http请求类
  3. \phpshow\lib\mysql 数据库驱动
  4. \phpshow\lib\debug 页面调试
  5. \phpshow\lib\jwt jwt会话验证
  6. \phpshow\lib\log 日志类
  7. \phpshow\lib\pool 进程池
  8. \phpshow\helper\util 辅助函数库

模型层

继承\phpshow\model即可调用相关函数

  1. insert1 新增数据
  2. update1 更新数据
  3. get_one 获取一条数据
  4. get_all 获取所有数据
  5. get_sql_one 获取指定sql的一条数据
  6. get_sql_all 获取指定sql的全部数据

模板引擎

使用纯php输出,模板里简单用 作为标签 vue带领大家,前后端分离,没需要用到模拟引擎

简单缓存

使用

  • 设置缓存 \phpshow\loader::set($key,$value);
  • 获取缓存 \phpshow\loader::get($key);
  • 建议与反馈

    联系本人 9448923#qq.com

    Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].