infotechnohelp/cakephp-skeleton-page

CakePHP 3 插件

安装: 412

依赖项: 0

建议者: 0

安全: 0

星标: 0

分支: 0

类型:cakephp-plugin

dev-master 2019-03-28 18:27 UTC

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 =