定制 magento/magento-composer-installer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

magento/magento-composer-installer

Composer 安装命令:

composer require magento/magento-composer-installer

包简介

Composer installer for Magento modules

README 文档

README

This is a fork of the Magento Composer Installer repo that provides support for Magento 2 components (modules, themes, language packages, libraries and components).

Usage

In the component's composer.json, specify:

  • type, type of Magento 2 component.

  • extra/map, list of files to move and their paths relative to the Magento root directory.

  • extra/chmod, list of permissions that should be set for files.

    Note:

    • extra/map is required only if your component needs to be moved to a location other than <Magento root>/vendor. Otherwise, omit this section.
    • extra/chmod is required only if you need to set specific permissions for files.

Supported Components

The following list explains the use of type in composer.json.

Magento Module

"type": "magento2-module"

Installation location: Default vendor directory or as defined in extra/map

Example:

{
    "name": "magento/module-core",
    "description": "N/A",
    "require": {
        ...
    },
    "type": "magento2-module",
    "extra": {
        "map": [
            [
                "*",
                "Magento/Core"
            ]
        ]
    }
}

Final location is <magento root>/app/code/Magento/Core

Magento Theme

"type": "magento2-theme"

Installation location: app/design

Example:

{
    "name": "magento/theme-frontend-luma",
    "description": "N/A",
    "require": {
        ...
    },
    "type": "magento2-theme",
    "extra": {
        "map": [
            [
                "*",
                "frontend/Magento/luma"
            ]
        ]
    }
}

Final location is <magento_root>/app/design/frontend/Magento/luma

Magento Language Package

"type": "magento2-language"

Installation location: app/i18n

Example:

{
    "name": "magento/language-de_de",
    "description": "German (Germany) language",
    "require": {
        ...
    },
    "type": "magento2-language",
    "extra": {
        "map": [
            [
                "*",
                "Magento/de_DE"
            ]
        ]
    }
}

Final location is <magento_root>/app/i18n/Magento/de_DE

Magento Library

"type": "magento2-library"

Support for libraries located in lib/internal instead of in the vendor directory.

Example:

{
    "name": "magento/framework",
    "description": "N/A",
    "require": {
       ...
    },
    "type": "magento2-library",
    "extra": {
        "map": [
            [
                "*",
                "Magento/Framework"
            ]
        ]
    }
}

Final location is <magento_root>/lib/internal/Magento/Framework

Magento Component

"type": "magento2-component"

Installation location: Magento root directory

Example:

{
    "name": "magento/migration-tool",
    "description": "N/A",
    "require": {
        ...
    },
    "type": "magento2-component",
    "extra": {
        "map": [
            [
                "*",
                "dev/tools/Magento/Tools/Migration"
            ]
        ]
    }
}

Final location is <magento_root>/dev/tools/Magento/Tools/Migration

Autoload

After handling all Magento components, <magento_root>/app/etc/vendor_path.php specifies the path to your vendor directory.

This information allows the Magento application to utilize the Composer autoloader for any libraries installed in the vendor directory. The path to vendor varies between particular installations and depends on the magento_root setting for the Magento Composer installer. That's why it should be generated for each installation.

You must run composer install to install dependencies for a new application or composer update to update dependencies for an existing application.

Deployment Strategy

The Magneto Composer Installer uses the copy deployment strategy. It copies each file or directory from the vendor directory to its designated location based on the extra/map section in the component's composer.json.

There are other deployment strategies that could be used; however, we don't guarantee that any of them will work.

Usage extra/chmod

The following example shows how you can set specific permissions for files.

Example:

{
    "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 is a bit mask for chmod command

path is a path to file relative to the Magento root folder

Notes

  • The extra->magento-root-dir option is no longer supported. It displays only to preseve backward compatibility.

magento/magento-composer-installer 适用场景与选型建议

magento/magento-composer-installer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24.06M 次下载、GitHub Stars 达 75, 最近一次更新时间为 2014 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「magento」 「composer-installer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 magento/magento-composer-installer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 magento/magento-composer-installer 我们能提供哪些服务?
定制开发 / 二次开发

基于 magento/magento-composer-installer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 24.06M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 79
  • 点击次数: 18
  • 依赖项目数: 395
  • 推荐数: 0

GitHub 信息

  • Stars: 75
  • Watchers: 41
  • Forks: 154
  • 开发语言: PHP

其他信息

  • 授权协议: OSL-3.0
  • 更新时间: 2014-07-03