magento / magento-composer-installer
Magento模块的Composer安装程序
Requires
- composer-plugin-api: ^1.1 || ^2.0
- composer/composer: ^1.9 || ^2.0
- laminas/laminas-stdlib: ^3.11.0
Requires (Dev)
- mikey179/vfsstream: *
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ~3.6.1
- symfony/process: ~5.4.0
Replaces
This package is auto-updated.
Last update: 2024-09-16 01:49:24 UTC
README
这是一个Magento Composer Installer仓库的分支,为Magento 2组件(模块、主题、语言包、库和组件)提供支持。
用法
在组件的 composer.json
中指定
-
type
,Magento 2组件的类型。 -
extra/map
,需要移动的文件列表及其相对于Magento根目录的路径。 -
extra/chmod
,需要设置的文件权限列表。注意:
extra/map
仅在您的组件需要移动到除<Magento根目录>/vendor
之外的位置时才需要。否则,省略此部分。extra/chmod
仅在您需要为文件设置特定权限时才需要。
支持的组件
以下列表解释了在composer.json
中使用type
的方法。
Magento模块
"type": "magento2-module"
安装位置:默认供应商目录或由extra/map
定义
示例
{ "name": "magento/module-core", "description": "N/A", "require": { ... }, "type": "magento2-module", "extra": { "map": [ [ "*", "Magento/Core" ] ] } }
最终位置是<magento根目录>/app/code/Magento/Core
Magento主题
"type": "magento2-theme"
安装位置:app/design
示例
{ "name": "magento/theme-frontend-luma", "description": "N/A", "require": { ... }, "type": "magento2-theme", "extra": { "map": [ [ "*", "frontend/Magento/luma" ] ] } }
最终位置是<magento_root>/app/design/frontend/Magento/luma
Magento语言包
"type": "magento2-language"
安装位置:app/i18n
示例
{ "name": "magento/language-de_de", "description": "German (Germany) language", "require": { ... }, "type": "magento2-language", "extra": { "map": [ [ "*", "Magento/de_DE" ] ] } }
最终位置是<magento_root>/app/i18n/Magento/de_DE
Magento库
"type": "magento2-library"
支持位于lib/internal
而不是位于vendor
目录中的库。
示例
{ "name": "magento/framework", "description": "N/A", "require": { ... }, "type": "magento2-library", "extra": { "map": [ [ "*", "Magento/Framework" ] ] } }
最终位置是<magento_root>/lib/internal/Magento/Framework
Magento组件
"type": "magento2-component"
安装位置:Magento根目录
示例
{ "name": "magento/migration-tool", "description": "N/A", "require": { ... }, "type": "magento2-component", "extra": { "map": [ [ "*", "dev/tools/Magento/Tools/Migration" ] ] } }
最终位置是<magento_root>/dev/tools/Magento/Tools/Migration
自动加载
处理完所有Magento组件后,<magento_root>/app/etc/vendor_path.php
指定了vendor
目录的路径。
这些信息允许Magento应用程序利用Composer自动加载器来利用在vendor
目录中安装的任何库。由于vendor
的路径在不同安装中不同,并且取决于Magento Composer安装器的magento_root
设置,因此它应该为每个安装生成。
您必须运行composer install
来安装新应用程序的依赖项,或运行composer update
来更新现有应用程序的依赖项。
部署策略
Magneto Composer Installer使用copy
部署策略。它根据组件composer.json
中的extra/map
部分将每个文件或目录从vendor
目录复制到指定的位置。
还有其他可以使用的部署策略,但我们不能保证它们中的任何一个都能正常工作。
extra/chmod
的用法
以下示例展示了如何为文件设置特定权限。
示例
{ "name": "magento/module-sample", "description": "N/A", "require": { ... }, "type": "magento2-module", "extra": { "chmod": [ { "mask": "0755", "path": "bin/magento" }, { "mask": "0644", "path": "some_dir/file.jpg" } ] } }
mask
是chmod命令的位掩码
path
是相对于Magento根文件夹的文件路径
注意
- extra->magento-root-dir选项不再受支持。它仅显示以保持向后兼容。