1 Star 1 Fork 0

向林 / 萌推

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

瞎写的

介紹

瞎写的,自己用的

架構

瞎几吧乱抄的, 依赖以下扩展

phpredis
swoole
inotify

安裝教程

新建 $dir/composer.json  
新建 $dir/app/controller  
新建 $dir/app/model  
新建 $dir/app/middleware  
新建 $dir/commands  
新建 $dir/components  
新建 $dir/config  
新建 $dir/routes 

添加composer 内容

{
	"autoload": {
		"psr-4": {
			"App\\": "app"
		},
		"files": [
		]
	},
	"require": {
		"php": ">= 7.1",
	},
	"require-dev": {
		"forset/forset": "dev-master",
		"swoole/ide-helper": "@dev"
	}
}
执行 composer update

使用說明

新建 $dir/routes/web.php

<?php

use BeReborn\Route\Router;

/** @var Router $router */
$router->get('index', 'SiteController@index');
$router->post('index', 'SiteController@index');
$router->any('index', 'SiteController@index');
$router->delete('index', 'SiteController@index');
$router->put('index', 'SiteController@index');

$options = [
    'prefix' => '', //前缀
    'namespace' => '', //Controller使用的命名空间如  namespace='server'则访问 app\controller\server\TestController
    'filter' => [   // 过滤请求用的, 参数效验同 model写法
    	 'grant' => [] ,    //权限效验回调函数
    	 'header' => [      //效验请求头所需数据
    	 	[['token', 'user', 'time', 'source'], 'required'],
    	 	[['token', 'source'], 'string'],
    	 	[['user', 'time'], 'int', 'maxLength' => 32],
         ],
    	 'body' => [      //效验请求体所需数据
    	 	[['token', 'user', 'time', 'source'], 'required'],
    	 	[['token', 'source'], 'string'],
    	 	[['user', 'time'], 'int', 'maxLength' => 32],
         ]
     ],     
    'middleware' => '',  // 中间件	
    'options' => '',  // ajax跨域请求处理	
];

$router->group($options, function (\BeReborn\Route\Router $router){
    $router->get('index', 'SiteController@index');
    $router->post('index', 'SiteController@index');
    $router->any('index', 'SiteController@index');
    $router->delete('index', 'SiteController@index');
    $router->put('index', 'SiteController@index');
});

新建 $dir/execfile并添加内容

<?php
error_reporting(E_ALL & ~E_NOTICE);

define('APP_PATH', __DIR__);
define('DISPLAY_ERRORS', TRUE);
define('DEBUG', TRUE);
define('DB_EMPTY', 3001);
define('DB_ERROR', 3002);
define('PARAM_NOT_EXISTS', 4001);
define('PARAM_EMPTY', 4004);

//ini_set('memory_limit','8192M');

use BeReborn\Web\Application;

require_once __DIR__ . '/vendor/autoload.php';
$config = require_once __DIR__ . '/config/configure.php';
$application = new Application($config);
$snooze = $application->getSwooleServer($argv);
if (!$snooze) {
	return;
}
$snooze->start();

添加配置项内容 $dir/config/configure.php

<?php
启动  php $dir/execfile 或 php $dir/execfile start  
重启  php $dir/execfile restart   
停止  php $dir/execfile stop 

#Command 注册命令

<?php
use BeReborn\Console\Command;
use BeReborn\Console\Dtl;

class exranpk extends Command{
	
	public $command = 'exmple:test';
	
	public $description = '任务描述';
	
	public $dataFile = '/usr/local/config.json';
	
	public $dataType = 'json';
	
	public function handler(Dtl $dtl)
	{
		
	}
	
}

使用

php artisan command_name --key=o --key=b --key=v

參與貢獻

  1. Fork 本倉庫
  2. 新建 Feat_xxx 分支
  3. 提交代碼
  4. 新建 Pull Request

碼雲特技

  1. 使用 Readme_XXX.md 來支持不同的語言,例如 Readme_en.md, Readme_zh.md
  2. 碼雲官方博客 blog.gitee.com
  3. 妳可以 https://gitee.com/explore 這個地址來了解碼雲上的優秀開源項目
  4. GVP 全稱是碼雲最有價值開源項目,是碼雲綜合評定出的優秀開源項目
  5. 碼雲官方提供的使用手冊 https://gitee.com/help
  6. 碼雲封面人物是壹檔用來展示碼雲會員風采的欄目 https://gitee.com/gitee-stars/
MIT License Copyright (c) 2020 向林 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

好萌啊 展开 收起
PHP
MIT
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/dreamwithouttrace/be-reborn.git
git@gitee.com:dreamwithouttrace/be-reborn.git
dreamwithouttrace
be-reborn
萌推
master

搜索帮助