Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
TIGERB committed Jun 24, 2018
2 parents c4a7690 + 386d51a commit d810510
Show file tree
Hide file tree
Showing 20 changed files with 235 additions and 118 deletions.
5 changes: 4 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ password = easyphp
[app_key_map]
315b279901cc47cc21897253b7850d57 = a76adae5c3bbbc3fdf9efb8ca091b7c7

[log_path]
[log]
path = /runtime/logs/
name = easy-php
size = 512
level= debug

[swoole]
worker_num = 5
Expand Down
50 changes: 40 additions & 10 deletions README-CN.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<p align="center"><img width="60%" src="logo.png"><p>
<p align="center"><img width="60%" src="http://cdn.tigerb.cn/logo.png"><p>

<p align="center">
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://api.travis-ci.org/TIGERB/easy-php.svg?branch=master" alt="Build Status"></a>
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://codecov.io/gh/TIGERB/easy-php/branch/master/graph/badge.svg" alt="Code Coverage"></a>
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://img.shields.io/badge/version-0.8.0-lightgrey.svg" alt="Version"></a>
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://img.shields.io/badge/version-0.8.1-lightgrey.svg" alt="Version"></a>
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://img.shields.io/badge/php-5.4%2B-blue.svg" alt="PHP Version"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/cocoapods/l/AFNetworking.svg" alt="License"></a>
</p>
Expand Down Expand Up @@ -110,6 +110,9 @@ frontend [前端源码和资源目录]
├── app.vue [根组件]
├── index.template.html [前端入口文件模板]
├── store.js [vuex store文件]
├── .babelrc [babel配置文件]
├── webpack.config.js [webpack配置文件]
├── yarn.lock [yarn lock文件]
jobs [脚本目录,写业务脚本的地方]
├── demo [模块目录]
│ ├── Demo.php [脚本演示文件]
Expand All @@ -131,12 +134,13 @@ vendor [composer目录]
.git-hooks [git钩子目录]
├── pre-commit [git pre-commit预commit钩子示例文件]
├── commit-msg [git commit-msg示例文件]
.babelrc [babel配置文件]
bin [自动化脚本目录]
├── build [php打包脚本]
├── cli [框架cli模式运行脚本]
├── run [快速开始脚本]
.env.example [环境变量示例文件]
.gitignore [git忽略文件配置]
.travis.yml [持续集成工具travis-ci配置文件]
build [php打包脚本]
cli [框架cli模式运行脚本]
LICENSE [lincese文件]
logo.png [框架logo图片]
composer.json [composer配置文件]
Expand All @@ -145,9 +149,6 @@ package.json [前端依赖配置文件]
phpunit.xml [phpunit配置文件]
README-CN.md [中文版readme文件]
README.md [readme文件]
run [快速开始脚本]
webpack.config.js [webpack配置文件]
yarn.lock [yarn lock文件]
```

Expand Down Expand Up @@ -580,6 +581,30 @@ App::$container->getSingle('mongodb');

[[file: framework/nosql/*](https://github.com/TIGERB/easy-php/tree/master/framework/nosql)]

## 日志模块

日志作为一个第三方独立的模块使用,达到模块化的目的,日志类项目地址<https://github.com/easy-framework/easy-log>

如何使用?如下,

```
// env 配置示例
[log]
path = /runtime/logs/
name = easy-php
size = 512
level= debug
// 业务中如何打日志
Log::debug('EASY PHP');
Log::notice('EASY PHP');
Log::warning('EASY PHP');
Log::error('EASY PHP');
```

[[file: framework/handles/LogHandle.php](https://github.com/TIGERB/easy-php/blob/master/framework/handles/LogHandle.php)]

## Swoole模式

支持swoole扩展下运行
Expand Down Expand Up @@ -735,7 +760,7 @@ Command:

快速开始一个demo:
```
php cli --run
cd bin && php cli --run
```
demo如下:

Expand Down Expand Up @@ -855,13 +880,16 @@ cp ./.git-hooks/* ./git/hooks
- 提供更友善的开发api帮助
- 模块支持数据库nosql自定义配置
- ORM提供更多链式操作api
- 框架log行为进行级别分类
- 想办法解决上线部署是配置文件问题
- 基于phar文件打包部署
- ...

# DONE

- v0.8.1(2018/06/24)
- 重构日志类
- 增加bin目录统一存放脚本文件

- v0.8.0(2017/12/29)
- 支持swoole扩展
- 修复微单体路由无限递归问题
Expand Down Expand Up @@ -890,5 +918,7 @@ cp ./.git-hooks/* ./git/hooks

## 交流群

<img src="http://cdn.tigerb.cn/wechat-blog-qrcode.jpg" width="300px">

<img src="http://cdn.tigerb.cn/qrcode.jpg" width="200px">

52 changes: 42 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<p align="center"><img width="60%" src="logo.png"><p>
<p align="center"><img width="60%" src="http://cdn.tigerb.cn/logo.png"><p>

<p align="center">
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://api.travis-ci.org/TIGERB/easy-php.svg?branch=master" alt="Build Status"></a>
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://codecov.io/gh/TIGERB/easy-php/branch/master/graph/badge.svg" alt="Code Coverage"></a>
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://img.shields.io/badge/version-0.8.0-lightgrey.svg" alt="Version"></a>
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://img.shields.io/badge/version-0.8.1-lightgrey.svg" alt="Version"></a>
<a href="https://github.com/TIGERB/easy-php/releases"><img src="https://img.shields.io/badge/php-5.4%2B-blue.svg" alt="PHP Version"></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/cocoapods/l/AFNetworking.svg" alt="License"></a>
</p>
Expand Down Expand Up @@ -108,6 +108,9 @@ frontend [application frontend source code directory]
├── app.vue [vue root component]
├── index.template.html [frontend entrance template file]
├── store.js [vuex store file]
├── .babelrc [babel config file]
├── webpack.config.js [webpack config file]
├── yarn.lock [yarn lock file]
jobs [Jobs folder, where write you business script]
├── demo [Module folder]
│ ├── Demo.php [Job script example file]
Expand All @@ -129,12 +132,13 @@ vendor [composer vendor directory]
.git-hooks [git hooks directory]
├── pre-commit [git pre-commit example file]
├── commit-msg [git commit-msg example file]
.babelrc [babel config file]
bin [the auto script folder]
├── build [build php code to phar file script]
├── cli [run this framework with the php cli mode]
├── run [quick start script]
.env.example [the environment variables example file]
.gitignore [git ignore config file]
.travis.yml [travis-ci config file]
build [build php code to phar file script]
cli [run this framework with the php cli mode]
LICENSE [lincese file]
logo.png [logo picture]
composer.json [composer file]
Expand All @@ -143,9 +147,6 @@ package.json [dependence file for frontend]
phpunit.xml [phpunit config file]
README-CN.md [readme file chinese]
README.md [readme file]
run [quick start shell script]
webpack.config.js [webpack config file]
yarn.lock [yarn lock file]
```

Expand Down Expand Up @@ -576,6 +577,32 @@ App::$container->getSingle('memcahed');
App::$container->getSingle('mongodb');
```

[[file: framework/nosql/*](https://github.com/TIGERB/easy-php/tree/master/framework/nosql)]

## Log

I make the log class like a third part module that be used by composer, the project link <https://github.com/easy-framework/easy-log>

How to use? as follows:

```
// env config
[log]
path = /runtime/logs/
name = easy-php
size = 512
level= debug
// How to use in your logic
Log::debug('EASY PHP');
Log::notice('EASY PHP');
Log::warning('EASY PHP');
Log::error('EASY PHP');
```

[[file: framework/handles/LogHandle.php](https://github.com/TIGERB/easy-php/blob/master/framework/handles/LogHandle.php)]

## Swoole Support

This framework support swoole mode with the php extension swoole, just:
Expand Down Expand Up @@ -731,7 +758,7 @@ Run:

Quick Start:
```
php cli --run
cd bin && php cli --run
```
demo as follows:

Expand Down Expand Up @@ -845,14 +872,17 @@ project address: [https://github.com/TIGERB/easy-php](https://github.com/TIGERB/
- Provide much friendly help for user
- Module's config support module-defined mysql and nosql configuration
- ORM provide more apis
- Make different rank for log
- Resolve config problem when publish our project
- implement auto deploy by used phar
- ...


# DONE

- v0.8.1(2017/06/24)
- use easy log
- add folder bin

- v0.8.0(2017/12/29)
- use swoole
- fix infinite recursion for micromonomer router
Expand Down Expand Up @@ -881,4 +911,6 @@ project address: [https://github.com/TIGERB/easy-php](https://github.com/TIGERB/

# CONTACT

<img src="http://cdn.tigerb.cn/wechat-blog-qrcode.jpg" width="300px">

<img src="http://cdn.tigerb.cn/qrcode.jpg" width="200px">
20 changes: 16 additions & 4 deletions app/demo/controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace App\Demo\Controllers;

use Framework\App;
use Framework\Logger;
use Easy\Log;

/**
* Index Controller
Expand Down Expand Up @@ -85,9 +85,21 @@ public function getInstanceFromContainerDemo()
App::$container->get('request');
// 配置对象
App::$container->getSingle('config');
// 日志对象
$logger = App::$container->getSingle('logger');
$logger->write(['Easy PHP logger']);

return [];
}

/**
* 写日志实例演示
*
* @return void
*/
public function log()
{
Log::debug('EASY PHP');
Log::notice('EASY PHP');
Log::warning('EASY PHP');
Log::error('EASY PHP');

return [];
}
Expand Down
12 changes: 6 additions & 6 deletions build → bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ $ext = 'phar';
$time = date('YmdHis', time());
$packageName = "{$packageName}.{$time}.{$ext}";

if (! file_exists(__DIR__ . '/runtime/build/')) {
mkdir(__DIR__ . '/runtime/build/');
if (! file_exists(__DIR__ . '/../runtime/build/')) {
mkdir(__DIR__ . '/../runtime/build/');
}

$phar = new Phar(
__DIR__ . '/runtime/build/' . $packageName,
__DIR__ . '/../runtime/build/' . $packageName,
0,
$packageName
);

$phar->buildFromDirectory(__DIR__ . '/', '/\.php$/');
$phar->buildFromDirectory(__DIR__ . '/', '/\.env$/');
$phar->buildFromDirectory(__DIR__ . '/../', '/\.php$/');
$phar->buildFromDirectory(__DIR__ . '/../', '/\.env$/');
$phar->buildFromDirectory(__DIR__ . '/', '/^cli$/');

$webIndex = "<?php
Expand All @@ -46,4 +46,4 @@ $phar->setStub(
$webIndex
);

echo "Build success in 'runtime/build/{$packageName}' \n";
echo "Build success in '/..runtime/build/{$packageName}' \n";
2 changes: 1 addition & 1 deletion cli → bin/cli
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ if (isset($input['method'])) {
$_REQUEST['argv'] = $input;

// 载入框架运行文件
require('framework/run.php');
require('../framework/run.php');
4 changes: 2 additions & 2 deletions run → bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
os=$(uname -a | awk 'BEGIN{FS=" "} {print $1}')

# step 1
yarn install
cd ../frontend && yarn install

# step 2
DOMAIN=http://localhost:60000 npm run demo
Expand All @@ -26,4 +26,4 @@ else
fi

# step 4
cd public && php -S "localhost:60000"
cd ../public && php -S "localhost:60000"
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tigerb/easy-php",
"description": "A Faster Lightweight Full-Stack PHP Framework",
"version": "0.7.1",
"version": "0.8.1",
"type": "framework",
"homepage": "http://php.tiegrb.cn/",
"license": "MIT",
Expand All @@ -15,7 +15,8 @@
"phpunit/phpunit": "^6.0"
},
"require": {
"mongodb/mongodb": "^1.1"
"mongodb/mongodb": "^1.1",
"easy-framework/easy-log": "^0.1.0"
},
"scripts": {
"post-install-cmd": [
Expand Down
Loading

0 comments on commit d810510

Please sign in to comment.