forked from top-think/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
357 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
sudo: false | ||
|
||
language: php | ||
|
||
services: | ||
- memcached | ||
- mongodb | ||
- mysql | ||
- postgresql | ||
- redis-server | ||
|
||
matrix: | ||
fast_finish: true | ||
include: | ||
- php: 5.4 | ||
- php: 5.5 | ||
- php: 5.6 | ||
- php: 7.0 | ||
- php: hhvm | ||
allow_failures: | ||
- php: hhvm | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
|
||
before_install: | ||
- composer self-update | ||
- mysql -e "create database IF NOT EXISTS test;" -uroot | ||
- psql -c 'DROP DATABASE IF EXISTS test;' -U postgres | ||
- psql -c 'create database test;' -U postgres | ||
|
||
install: | ||
- ./thinkphp/tests/script/install.sh | ||
|
||
script: | ||
## LINT | ||
- find thinkphp ! -path "vendor/*" -type f -name \*.php -exec php -l {} \; | ||
## PHP_CodeSniffer | ||
- vendor/bin/phpcs --runtime-set ignore_errors_on_exit 1 --runtime-set ignore_warnings_on_exit 1 --standard=PSR2 --ignore="vendor/*" thinkphp | ||
## PHP Copy/Paste Detector | ||
- vendor/bin/phpcpd --verbose --exclude vendor thinkphp || true | ||
## PHPLOC | ||
- vendor/bin/phploc --exclude vendor thinkphp | ||
## PHPUNIT | ||
- vendor/bin/phpunit --coverage-clover=coverage.xml --configuration=thinkphp/phpunit.xml | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
如何贡献我的源代码 | ||
=== | ||
|
||
此文档介绍了 ThinkPHP 团队的组成以及运转机制,您提交的代码将给 ThinkPHP 项目带来什么好处,以及如何才能加入我们的行列。 | ||
|
||
## 通过 Github 贡献代码 | ||
|
||
ThinkPHP 目前使用 Git 来控制程序版本,如果你想为 ThinkPHP 贡献源代码,请先大致了解 Git 的使用方法。我们目前把项目托管在 GitHub 上,任何 GitHub 用户都可以向我们贡献代码。 | ||
|
||
参与的方式很简单,`fork`一份 ThinkPHP 的代码到你的仓库中,修改后提交,并向我们发起`pull request`申请,我们会及时对代码进行审查并处理你的申请并。审查通过后,你的代码将被`merge`进我们的仓库中,这样你就会自动出现在贡献者名单里了,非常方便。 | ||
|
||
我们希望你贡献的代码符合: | ||
|
||
* ThinkPHP 的编码规范 | ||
* 适当的注释,能让其他人读懂 | ||
* 遵循 Apache2 开源协议 | ||
|
||
**如果想要了解更多细节或有任何疑问,请继续阅读下面的内容** | ||
|
||
### 注意事项 | ||
|
||
* 本项目代码格式化标准选用 [**PSR-2**](http://www.kancloud.cn/thinkphp/php-fig-psr/3141); | ||
* 类名和类文件名遵循 [**PSR-4**](http://www.kancloud.cn/thinkphp/php-fig-psr/3144); | ||
* 对于 Issues 的处理,请使用诸如 `fix #xxx(Issue ID)` 的 commit title 直接关闭 issue。 | ||
* 系统会自动在 PHP 5.4 5.5 5.6 7.0 和 HHVM 上测试修改,其中 HHVM 下的测试容许报错,请确保你的修改符合 PHP 5.4 ~ 5.6 和 PHP 7.0 的语法规范; | ||
* 管理员不会合并造成 CI faild 的修改,若出现 CI faild 请检查自己的源代码或修改相应的[单元测试文件](thinkphp/tests); | ||
|
||
## GitHub Issue | ||
|
||
GitHub 提供了 Issue 功能,该功能可以用于: | ||
|
||
* 提出 bug | ||
* 提出功能改进 | ||
* 反馈使用体验 | ||
|
||
该功能不应该用于: | ||
|
||
* 提出修改意见(涉及代码署名和修订追溯问题) | ||
* 不友善的言论 | ||
|
||
## 快速修改 | ||
|
||
**GitHub 提供了快速编辑文件的功能** | ||
|
||
1. 登录 GitHub 帐号; | ||
2. 浏览项目文件,找到要进行修改的文件; | ||
3. 点击右上角铅笔图标进行修改; | ||
4. 填写 `Commit changes` 相关内容(Title 必填); | ||
5. 提交修改,等待 CI 验证和管理员合并。 | ||
|
||
**若您需要一次提交大量修改,请继续阅读下面的内容** | ||
|
||
## 完整流程 | ||
|
||
1. `fork`本项目; | ||
2. 克隆(`clone`)你 `fork` 的项目到本地; | ||
3. 新建分支(`branch`)并检出(`checkout`)新分支; | ||
4. 添加本项目到你的本地 git 仓库作为上游(`upstream`); | ||
5. 进行修改,若你的修改包含方法或函数的增减,请记得修改[单元测试文件](thinkphp/tests); | ||
6. 变基(衍合 `rebase`)你的分支到上游 master 分支; | ||
7. `push` 你的本地仓库到 GitHub; | ||
8. 提交 ``pull request`s`; | ||
9. 等待 CI 验证(若不通过则重复 5~7,GitHub 会自动更新你的 ``pull request`s`); | ||
10. 等待管理员处理,并及时 `rebase` 你的分支到上游 master 分支(若上游 master 分支有修改)。 | ||
|
||
*若有必要,可以 `git push -f` 强行推送 rebase 后的分支到自己的 GitHub `fork`* | ||
|
||
### 注意事项 | ||
|
||
* 若对上述流程有任何不清楚的地方,请查阅 GIT 教程,如 [这个](http://backlogtool.com/git-guide/cn/); | ||
* 对于代码**不同方面**的修改,请在自己 `fork` 的项目中**创建不同的分支**(原因参见`完整流程`第9条备注部分); | ||
* 变基及交互式变基操作参见 [Git 交互式变基](http://pakchoi.me/2015/03/17/git-interactive-rebase/) | ||
|
||
## 推荐资源 | ||
|
||
### 开发环境 | ||
|
||
* XAMPP for Windows 5.5.x | ||
* WampServer (for Windows) | ||
* upupw Apache PHP5.4 ( for Windows) | ||
|
||
或自行安装 | ||
|
||
- Apache / Nginx | ||
- PHP 5.4 ~ 5.6 | ||
- MySQL / MariaDB | ||
|
||
*Windows 用户推荐添加 PHP bin 目录到 PATH,方便使用 composer* | ||
|
||
*Linux 用户自行配置环境, Mac 用户推荐使用内嵌 Apache 配合 Homebrew 安装 PHP 和 MariaDB* | ||
|
||
### 编辑器 | ||
|
||
Sublime Text 3 + phpfmt 插件 | ||
|
||
phpfmt 插件参数 | ||
|
||
```json | ||
{ | ||
"enable_auto_align": true, | ||
"indent_with_space": true, | ||
"psr1_naming": true, | ||
"psr2": true, | ||
"version": 1 | ||
} | ||
``` | ||
|
||
或其他 编辑器 / IDE 配合 PSR2 自动格式化工具 | ||
|
||
### Git GUI | ||
|
||
* SourceTree | ||
* GitHub Desktop | ||
|
||
或其他 Git 图形界面客户端 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 | ||
版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) | ||
All rights reserved。 | ||
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 | ||
|
||
Apache Licence是著名的非盈利开源组织Apache采用的协议。 | ||
该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, | ||
允许代码修改,再作为开源或商业软件发布。需要满足 | ||
的条件: | ||
1. 需要给代码的用户一份Apache Licence ; | ||
2. 如果你修改了代码,需要在被修改的文件中说明; | ||
3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 | ||
带有原来代码中的协议,商标,专利声明和其他原来作者规 | ||
定需要包含的说明; | ||
4. 如果再发布的产品中包含一个Notice文件,则在Notice文 | ||
件中需要带有本协议内容。你可以在Notice中增加自己的 | ||
许可,但不可以表现为对Apache Licence构成更改。 | ||
具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
ThinkPHP 5.0.0 RC2 | ||
=============== | ||
|
||
[](https://travis-ci.org/top-think/think) | ||
[](https://codecov.io/github/top-think/think) | ||
[](https://github.com/top-think/think/releases) | ||
[](https://github.com/top-think/think/releases/latest) | ||
[](https://github.com/top-think/think/releases/latest) | ||
[](https://packagist.org/packages/topthink/think) | ||
[](https://packagist.org/packages/topthink/think) | ||
|
||
ThinkPHP5在保持快速开发和大道至简的核心理念不变的同时,PHP版本要求提升到5.4,对已有的CBD模式做了更深的强化,优化核心,减少依赖,基于全新的架构思想和命名空间实现,是ThinkPHP突破原有框架思路的颠覆之作,其主要特性包括: | ||
|
||
+ 基于命名空间和众多PHP新特性 | ||
+ 核心功能组件化 | ||
+ 强化路由功能 | ||
+ 更灵活的控制器 | ||
+ 配置文件可分离 | ||
+ 重写的自动验证和完成 | ||
+ 简化扩展机制 | ||
+ API支持完善 | ||
+ 改进的Log类 | ||
+ 命令行访问支持 | ||
+ REST支持 | ||
+ 引导文件支持 | ||
+ 方便的自动生成定义 | ||
+ 真正惰性加载 | ||
+ 分布式环境支持 | ||
+ 更多的社交类库 | ||
|
||
> ThinkPHP5的运行环境要求PHP5.4以上。 | ||
详细开发文档参考 [ThinkPHP5完全开发手册](http://www.kancloud.cn/manual/thinkphp5) | ||
|
||
## 目录结构 | ||
|
||
初始的目录结构如下: | ||
|
||
~~~ | ||
www WEB部署目录(或者子目录) | ||
├─composer.json composer定义文件 | ||
├─README.md README文件 | ||
├─LICENSE.txt 授权说明文件 | ||
├─application 应用目录 | ||
│ ├─common 公共模块目录(可以更改) | ||
│ ├─runtime 应用的运行时目录(可写,可定制) | ||
│ ├─module_name 模块目录 | ||
│ │ ├─config.php 模块配置文件 | ||
│ │ ├─common.php 模块函数文件 | ||
│ │ ├─controller 控制器目录 | ||
│ │ ├─model 模型目录 | ||
│ │ ├─view 视图目录 | ||
│ │ └─ ... 更多类库目录 | ||
│ │ | ||
│ ├─common.php 公共函数文件 | ||
│ ├─config.php 公共配置文件 | ||
│ ├─route.php 路由配置文件 | ||
│ └─database.php 数据库配置文件 | ||
│ | ||
├─public WEB目录(对外访问目录) | ||
│ ├─index.php 入口文件 | ||
│ ├─.htaccess 用于apache的重写 | ||
│ └─router.php 快速测试文件(用于PHP内置webserver) | ||
│ | ||
├─thinkphp 框架系统目录 | ||
│ ├─lang 语言文件目录 | ||
│ ├─library 框架类库目录 | ||
│ │ ├─think Think类库包目录 | ||
│ │ └─traits 系统Trait目录 | ||
│ │ | ||
│ ├─mode 应用模式目录 | ||
│ ├─tpl 系统模板目录 | ||
│ ├─tests 单元测试文件目录 | ||
│ ├─vendor 第三方类库目录(Composer依赖库) | ||
│ ├─base.php 基础定义文件 | ||
│ ├─convention.php 框架惯例配置文件 | ||
│ ├─helper.php 助手函数文件 | ||
│ ├─phpunit.xml phpunit配置文件 | ||
│ └─start.php 框架入口文件 | ||
~~~ | ||
|
||
> router.php用于php自带webserver支持,可用于快速测试 | ||
> 切换到public目录后,启动命令:php -S localhost:8888 router.php | ||
> 上面的目录结构和名称是可以改变的,这取决于你的入口文件和配置参数。 | ||
## 命名规范 | ||
|
||
ThinkPHP5的命名规范如下: | ||
|
||
### 目录和文件 | ||
|
||
* 目录不强制规范,驼峰和小写+下划线模式均支持; | ||
* 类库、函数文件统一以`.php`为后缀; | ||
* 类的文件名均以命名空间定义,并且命名空间的路径和类库文件所在路径一致; | ||
* 类名和类文件名保持一致,统一采用驼峰法命名(首字母大写); | ||
|
||
### 函数和类、属性命名 | ||
* 类的命名采用驼峰法,并且首字母大写,例如 `User`、`UserType`,不需要添加后缀,例如UserController应该直接命名为User; | ||
* 函数的命名使用小写字母和下划线(小写字母开头)的方式,例如 `get_client_ip`; | ||
* 方法的命名使用驼峰法,并且首字母小写或者使用下划线“_”,例如 `getUserName`,`_parseType`,通常下划线开头的方法属于私有方法; | ||
* 属性的命名使用驼峰法,并且首字母小写或者使用下划线“_”,例如 `tableName`、`_instance`,通常下划线开头的属性属于私有属性; | ||
* 以双下划线“__”打头的函数或方法作为魔法方法,例如 `__call` 和 `__autoload`; | ||
|
||
### 常量和配置 | ||
* 常量以大写字母和下划线命名,例如 `APP_DEBUG`和 `APP_MODE`; | ||
* 配置参数以小写字母和下划线命名,例如 `url_route_on`; | ||
|
||
### 数据表和字段 | ||
* 数据表和字段采用小写加下划线方式命名,并注意字段名不要以下划线开头,例如 think_user 表和 user_name字段,类似 _username 这样的数据表字段可能会被过滤。 | ||
|
||
## 参与开发 | ||
注册并登录 Github 帐号, fork 本项目并进行改动。 | ||
|
||
更多细节参阅 [CONTRIBUTING.md](CONTRIBUTING.md) | ||
|
||
## 版权信息 | ||
|
||
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 | ||
|
||
本项目包含的第三方源码和二进制文件之版权信息另行标注。 | ||
|
||
版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) | ||
|
||
All rights reserved。 | ||
|
||
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 | ||
|
||
更多细节参阅 [LICENSE.txt](LICENSE.txt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "topthink/framework", | ||
"description": "the new thinkphp framework", | ||
"type": "thinkphp-framework", | ||
"keywords": ["framework", "thinkphp", "ORM"], | ||
"homepage": "http://thinkphp.cn/", | ||
"license": "Apache2", | ||
"authors": [ | ||
{ | ||
"name": "liu21st", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.4.0" | ||
}, | ||
"require-dev": { | ||
"johnkary/phpunit-speedtrap": "^1.0", | ||
"mikey179/vfsStream": "~1.6", | ||
"phploc/phploc": "*", | ||
"phpunit/phpunit": "4.8.*", | ||
"sebastian/phpcpd": "*", | ||
"squizlabs/php_codesniffer": "2.*" | ||
}, | ||
"config": { | ||
"vendor-dir": "vendor" | ||
}, | ||
"extra": { | ||
"installer-paths": { | ||
"thinkphp": ["type:thinkphp-framework"] | ||
} | ||
} | ||
} |