cakephp/plugin-installer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cakephp/plugin-installer

最新稳定版本:2.0.1

Composer 安装命令:

composer require cakephp/plugin-installer

包简介

A composer installer for CakePHP plugins.

README 文档

README

Build Status Latest Stable Version Total Downloads Software License

A composer installer for installing CakePHP plugins.

This installer ensures your application is aware of CakePHP plugins installed by composer in vendor/.

Usage

Your CakePHP application should already depend on cakephp/plugin-installer, if not in your CakePHP application run:

composer require cakephp/plugin-installer:*

Your plugins themselves do not need to require cakephp/plugin-installer. They only need to specify the type in their composer config:

"type": "cakephp-plugin"

Multiple Plugin Paths

If your application uses multiple plugin paths. In addition to configuring your application settings you will also need to update your composer.json to ensure the generated cakephp-plugins.php file is correct:

// Define the list of plugin-paths your application uses.
"extra": {
    "plugin-paths": ["plugins", "extra_plugins"]
}

Plugin Setup

For the installer to work properly ensure that your plugin's composer config file has a proper autoload section. Assuming your plugin's namespace is "MyPlugin" the autoload section would be like:

"autoload": {
    "psr-4": {
        "MyPlugin\\": "src/"
    }
}

Not strictly necessary for the working of the installer but ideally you would also have an "autoload-dev" section for loading test files:

"autoload": {
    "psr-4": {
        "MyPlugin\\": "src/"
    }
},
"autoload-dev": {
    "psr-4": {
        "MyPlugin\\Test\\": "tests/",
        "Cake\\Test\\" : "vendor/cakephp/cakephp/tests/"
    }
}

If your top level namespace is a vendor name then your namespace to path mapping would be like:

"autoload": {
    "psr-4": {
        "MyVendor\\MyPlugin\\": "src/"
    }
},
"autoload-dev": {
    "psr-4": {
        "MyVendor\\MyPlugin\\Test\\": "tests/",
        "Cake\\Test\\" : "vendor/cakephp/cakephp/tests/"
    }
}

Generating Manually

If you need to generate cakephp-plugins.php separately, you can simply run the dumpautoload command:

composer dumpautoload

You cannot use --no-scripts with dumpautoload or cakephp-plugins.php will not generate.

If you don't want to re-generate the entire autoload dump, you can run just the scripts:

composer run-script post-autoload-dump

Please see composer documentation for details.

统计信息

  • 总下载量: 11.3M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 32
  • 点击次数: 1
  • 依赖项目数: 265
  • 推荐数: 0

GitHub 信息

  • Stars: 31
  • Watchers: 22
  • Forks: 15
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04