diff --git a/README.md b/README.md index cbc39be..9ec9538 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,65 @@ -# HyperfDevelopmentKit +# Hyperf Development Kit -用于 Hyperf 框架的开发工具集。 +A General Development Kit for Hyperf. -## 特性 +> 本文面向贡献者,而非使用者。 +> +> 使用者请移步 [Guide](./guide.md) -按 [DDD(领域驱动设计)]() 的思想进行目录结构划分 +## Feature -## 安装 +The structure is based on below theories: +* [DDD(Domain-Driven Design)](https://zh.wikipedia.org/wiki/%E9%A0%98%E5%9F%9F%E9%A9%85%E5%8B%95%E8%A8%AD%E8%A8%88) +* [TDD (Test-Driven Design)](https://zh.wikipedia.org/wiki/%E6%B5%8B%E8%AF%95%E9%A9%B1%E5%8A%A8%E5%BC%80%E5%8F%91) + +## Installation + +```bash +git clone http://124.126.16.154:8888/singularity/HyperfDevelopmentKit.git hdk \ +&& cd hdk \ +&& ./scripts/docker-env.sh \ +&& composer install ``` -composer config secure-http false \ -&& composer config repo.lux-map composer https://satis.luxcreo.cn/ \ -&& composer require singularity/hyperf-development-kit "dev-main" \ -&& php bin/hyperf vendor:publish singularity/hyperf-development-kit -``` + +## Quick Start + +All service is in *src/* . + +There are many dictionaries here to meaning each **Domain** -- you can replacing it as a *Project*. Every domain owns +their fully dictionary structures. Such as *Services* or *Constants* and so on. The main way to use these is used by * +Micro Services* and *PRC*. + +And there is a special **Domain** named *Utils*. + +***Utils*** contains fully general components. They don't need be depends on any other domain or project. You **must** +make sure them pure. + +And the test and verify way for a single package is different with classic way. + +There are two way to do it. + +1. ***(Recommand and Elegent)*** To do unit test with these testing tools below(It also named TDD). +2. *(Hack, but useful)* To require and code it in your project. For example, + 1. require hdk in LuxStudio + 2. and modify it in *vendor/*, + 3. then + 1. copy your changes to your hdk repo + 2. or commit those with git directly) + +## Testing Tools + +There are a number of testing tools available for PHP. The most popular one is [PHPUnit](https://phpunit.de/). PHPUnit +follows the classic xUnit approach. + +[Behat](http://behat.org/en/latest/) is the most popular behaviour-driven development (BDD) testing framework. + +[Codeception](http://codeception.com/) is a framework combining BDD, unit testing, and integration testing, and is +cross-compatible with PHPUnit. + +In this guide we will be using PHPUnit as the testing framework. + +> And I'm tring to integrate [Codeception](http://codeception.com/) to hdk. --- diff --git a/guide.md b/guide.md index e69de29..eece61a 100644 --- a/guide.md +++ b/guide.md @@ -0,0 +1,34 @@ +# HDK 最佳实践 + +> 本文面向 HDK 的使用者,如果你想参与贡献,请移步 [README](./README.md) + +## 概述 + +HDK 主要包含了以下几部分内容,这也是这个库的边界: + +* 开始一个新的 *Hyperf* 项目所需的脚本 +* 通用类、函数 + * 通用异常、错误码及错误捕获 +* 项目相关 *RPC* 连接器 + +## 安装 + +```bash +composer config secure-http false \ +&& composer config repo.lux-map composer https://satis.luxcreo.cn/ \ +&& composer require singularity/hyperf-development-kit \ +&& php bin/hyperf vendor:publish singularity/hyperf-development-kit +``` + +## 配置 + +配置,是 HDK 保证灵活性的重要一环。 + +当你使用上面的命令进行安装之后,即已经发布了 HDK 的配置文件,*config/autoload/common.php*。 + +主要分为以下几块: + +* 响应相关 +* 鉴权相关 +* redis 补充配置 +* 领域所需的特定配置