infotechnohelp / cakephp-skeleton-page
CakePHP 3 插件
dev-master
2019-03-28 18:27 UTC
Requires
- cakephp/cakephp: ^3.4
- vlucas/phpdotenv: ^2.4
Requires (Dev)
- doctrine/instantiator: 1.0.*
- phpunit/phpunit: ^5.7|^6.0
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-09-29 05:21:37 UTC
README
PLUGIN/composer.json
修改 "name" 值
替换路径中的 PLUGIN
骨架 → 任何插件名称
骨架 → any-plugin-name
加载插件
将此行添加到 APP/config/bootstrap.php
Plugin::load('AnyPluginName', ['routes' => true]);
迁移表到 APP 目录
CakePHP 3+ APP 根目录
$ bin/cake migrations migrate --plugin AnyPluginName
API 层
前缀 any-plugin-name/api
为了发送请求到 PLUGIN/src/Controller/Api/MyPluginController→getById()
,使用此路径
any-plugin-name/api/my-plugin/get-by-id
测试
运行测试(插件根目录)
vendor/bin/phpunit
为了在 APP/tests
中使用插件的 fixtures,添加以下内容到 APP/composer.json
"autoload-dev": {
"psr-4": {
... ,
"AnyPluginName\\Test\\": "./vendor/philsweb/cakephp-plugin-skeleton/tests",
}
},
composer dump-autoload
嗅探
修复(插件根目录)
./sniff -f
检查冲突(插件根目录)
./sniff
PLUGIN/config/.env
export DB_TEST_HOST = localhost
export DB_TEST_NAME = test
export DB_TEST_USERNAME = root
export DB_TEST_PASSWORD =