可维护性.md 849 B

命名

为避免混淆,代码中有以下命名约定。

  1. 原则

变量/函数名/类名的定义采用概念的逆向单词排列。比如: QQ三方认证登录,微信三方认证登录分别对应为

QQ三方认证登录 : auth_qq

微信三方认证登录: auth_wechat

而不是 qq_auth, wechat_auth

  1. 名词对应表

支付宝 alipay 微信支付 wechatpay 公众号 public 微信公众号 wechat_public 小程序 mp 微信小程序 wechat_mp app: app android app: android ios app: ios

thinkphp model

在 controller 中调用 model 尽量封装到 model 类内部,避免 XxxxModel::where()->select(); 这种就地使用的方式。

composer 中添加 autoload 目录

  1. 在 composer.json 中添加
  2. 执行 composer dumpautoload

测试

  1. tests 目录中添加 TestCase
  2. 执行 ./vendor/bin/phpunit tests/*