- before require install
ext-mongodb
composer require mongodb/mongodb
swagger-php用于生成 swagger.json 文档。swagger-uiapi 文档展示codeception测试框架(已经包含了 phpunit)
- mysql
- mongodb
- redis
- memcache
- 入口文件
web/index.php - web控制器默认放在
app/Controllers目录
- 入口文件
bin/console - 命令行控制器放在
app/Console目录
执行:php bin/console 查看更多信息
在 resources/server-configs
推荐全局安装:
composer require --global zircote/swagger-php使用
vendor/bin/swagger --output web/docsswagger 2.0 定义 https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
swagger-ui 下载
npm install swagger-ui-dist- 或者 https://github.com/swagger-api/swagger-ui
拷贝 dist 下的所有文件到项目目录下 swagger-ui 目录
// 扫描当前文件夹下所有目录
vendor/bin/swagger --output web/docs
// 指定扫描一个或多个目录
vendor/bin/swagger --output web/docs [dirs ...]- 运行服务器(只能在内网查看)
./bin/dev-server
- 访问:
127.0.0.1:8066
codeception:
- 官网 http://codeception.com
- github https://github.com/codeception/codeception
- phalcon 配置demo https://github.com/Codeception/phalcon-demo
分为三类:
- acceptance 验收测试
- functional 功能测试
- unit 单元测试
将会创建基本的目录和配置文件
codecept bootstrap运行流程:
tests/_boot.php -> {suite}/_boot.php -> boot/web.php
codecept run --steps [--no-ansi]php5
php5 $(which codecept5.phar) run --steps [--no-ansi -vvv]
// 只运行单元测试
php5 $(which codecept5.phar) run unitphalcon 自带了操作类,不过是基于扩展 mongo (不再维护了)
若需要用较新的驱动,可以安装扩展 mongodb. 再安装php库 mongodb/mongodb 辅助使用。
composer require mongodb/mongodbMIT